aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManager.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManagerFactory.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java24
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManagerFactory.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java50
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManagerFactory.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java26
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java28
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java10
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManagerFactory.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java21
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManagerFactory.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java16
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManagerFactory.java10
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManager.java26
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManagerFactory.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java17
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VspManagerFactory.java10
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentDependencyModelErrorBuilder.java81
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CompositionEditNotAllowedErrorBuilder.java54
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java52
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java59
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java36
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java27
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java42
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java139
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/InformationArtifactCreationErrorBuilder.java31
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java59
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java76
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java28
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java118
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java37
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OrchestrationTemplateNotFoundErrorBuilder.java39
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java55
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java63
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java46
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java82
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java107
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/exception/OnboardPackageException.java1
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerFactoryImpl.java24
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java120
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java20
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java339
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerFactoryImpl.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java864
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java22
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java427
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java21
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java404
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java23
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java327
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java141
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java256
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java17
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java130
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java331
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java158
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerFactoryImpl.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java330
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java314
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java48
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/ManifestAnalyzer.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageContentHandler.java18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java84
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java110
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java50
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java58
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java36
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java582
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidator.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ManifestBuilder.java40
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidator.java43
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java121
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version4MetaDirectoryValidator.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/Validator.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/exception/MissingCertificateException.java1
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java3
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/ValidatorUtils.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/InvalidManifestMetadataException.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/OrchestrationTemplateHandlerException.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java70
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java205
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java263
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManager.java91
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java34
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java47
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java36
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackage.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardSignedPackage.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OrchestrationTemplateActionResponse.java145
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java48
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java142
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java134
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java65
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/zusammen/ItemProperties.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java78
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java151
125 files changed, 3909 insertions, 5121 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManager.java
index 7ac636879b..7cdec000b3 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,24 +17,21 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface ComponentDependencyModelManager {
- Collection<ComponentDependencyModelEntity> list(String vspId, Version version);
+ Collection<ComponentDependencyModelEntity> list(String vspId, Version version);
- ComponentDependencyModelEntity createComponentDependency(ComponentDependencyModelEntity entity,
- String vspId, Version version);
+ ComponentDependencyModelEntity createComponentDependency(ComponentDependencyModelEntity entity, String vspId, Version version);
- void delete(String vspId, Version version, String dependencyId);
+ void delete(String vspId, Version version, String dependencyId);
- void update(ComponentDependencyModelEntity entity);
+ void update(ComponentDependencyModelEntity entity);
- ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId);
+ ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManagerFactory.java
index bd5cd45561..ee2c447e20 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManagerFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,16 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
-
import org.openecomp.core.factory.api.AbstractComponentFactory;
-public abstract class ComponentDependencyModelManagerFactory extends
- AbstractComponentFactory<ComponentDependencyModelManager> {
+public abstract class ComponentDependencyModelManagerFactory extends AbstractComponentFactory<ComponentDependencyModelManager> {
- public static ComponentDependencyModelManagerFactory getInstance() {
- return getInstance(ComponentDependencyModelManagerFactory.class);
- }
+ public static ComponentDependencyModelManagerFactory getInstance() {
+ return getInstance(ComponentDependencyModelManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java
index 413529882d..a9a0a0377e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -27,27 +27,23 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface ComponentManager {
- Collection<ComponentEntity> listComponents(String vspId, Version version);
+ Collection<ComponentEntity> listComponents(String vspId, Version version);
- void deleteComponents(String vspId, Version version);
+ void deleteComponents(String vspId, Version version);
- ComponentEntity createComponent(ComponentEntity componentEntity);
+ ComponentEntity createComponent(ComponentEntity componentEntity);
- CompositionEntityValidationData updateComponent(ComponentEntity componentEntity);
+ CompositionEntityValidationData updateComponent(ComponentEntity componentEntity);
- CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version,
- String componentId);
+ CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version, String componentId);
- void deleteComponent(String vspId, Version version, String componentId);
+ void deleteComponent(String vspId, Version version, String componentId);
- QuestionnaireResponse getQuestionnaire(String vspId, Version version, String componentId);
+ QuestionnaireResponse getQuestionnaire(String vspId, Version version, String componentId);
- void updateQuestionnaire(String vspId, Version version, String componentId,
- String questionnaireData);
+ void updateQuestionnaire(String vspId, Version version, String componentId, String questionnaireData);
- void validateComponentExistence(String vspId, Version version, String componentId);
+ void validateComponentExistence(String vspId, Version version, String componentId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManagerFactory.java
index 9af238e4e3..154f0a8c44 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManagerFactory.java
@@ -17,14 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
public abstract class ComponentManagerFactory extends AbstractComponentFactory<ComponentManager> {
- public static ComponentManagerFactory getInstance() {
- return getInstance(ComponentManagerFactory.class);
- }
+ public static ComponentManagerFactory getInstance() {
+ return getInstance(ComponentManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java
index 2cf4063319..7899dd2bf1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java
@@ -13,10 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.*;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
@@ -25,44 +31,36 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
public interface CompositionEntityDataManager {
- Map<CompositionEntityId, Collection<String>> validateEntitiesQuestionnaire();
-
- void addEntity(CompositionEntity entity, SchemaTemplateInput schemaTemplateInput);
+ Map<CompositionEntityId, Collection<String>> validateEntitiesQuestionnaire();
- CompositionEntityValidationData validateEntity(CompositionEntity entity,
- SchemaTemplateContext schemaTemplateContext,
- SchemaTemplateInput schemaTemplateInput);
+ void addEntity(CompositionEntity entity, SchemaTemplateInput schemaTemplateInput);
- void buildTrees();
+ CompositionEntityValidationData validateEntity(CompositionEntity entity, SchemaTemplateContext schemaTemplateContext,
+ SchemaTemplateInput schemaTemplateInput);
- void addErrorsToTrees(Map<CompositionEntityId, Collection<String>> errors);
+ void buildTrees();
- Set<CompositionEntityValidationData> getEntityListWithErrors();
+ void addErrorsToTrees(Map<CompositionEntityId, Collection<String>> errors);
- Collection<CompositionEntityValidationData> getTrees();
+ Set<CompositionEntityValidationData> getEntityListWithErrors();
- void saveCompositionData(String vspId, Version version, CompositionData compositionData);
+ Collection<CompositionEntityValidationData> getTrees();
- Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId);
+ void saveCompositionData(String vspId, Version version, CompositionData compositionData);
- ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp);
+ Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId);
- NicEntity createNic(NicEntity nic);
+ ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp);
- DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor);
+ NicEntity createNic(NicEntity nic);
- ImageEntity createImage(ImageEntity image);
+ DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor);
- void saveComputesFlavorByComponent(String vspId, Version version, Component component,
- String componentId);
+ ImageEntity createImage(ImageEntity image);
- void saveImagesByComponent(String vspId, Version version, Component component,
- String componentId);
+ void saveComputesFlavorByComponent(String vspId, Version version, Component component, String componentId);
+ void saveImagesByComponent(String vspId, Version version, Component component, String componentId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManagerFactory.java
index be4f187c15..2d09bb2601 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManagerFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,15 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
-public abstract class CompositionEntityDataManagerFactory extends
- AbstractComponentFactory<CompositionEntityDataManager> {
+public abstract class CompositionEntityDataManagerFactory extends AbstractComponentFactory<CompositionEntityDataManager> {
- public static CompositionEntityDataManagerFactory getInstance() {
- return getInstance(CompositionEntityDataManagerFactory.class);
- }
+ public static CompositionEntityDataManagerFactory getInstance() {
+ return getInstance(CompositionEntityDataManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java
index ac903dd3da..bc531bc73f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
@@ -28,24 +28,19 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEnti
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface ComputeManager {
- Collection<ListComputeResponse> listComputes(String vspId, Version version, String componentId);
+ Collection<ListComputeResponse> listComputes(String vspId, Version version, String componentId);
- ComputeEntity createCompute(ComputeEntity compute);
+ ComputeEntity createCompute(ComputeEntity compute);
- CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version,
- String componentId, String computeFlavorId);
+ CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version, String componentId, String computeFlavorId);
- QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String componentId,
- String computeFlavorId);
+ QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String componentId, String computeFlavorId);
- void updateComputeQuestionnaire(String vspId, Version version, String componentId,
- String computeId, String questionnaireData);
+ void updateComputeQuestionnaire(String vspId, Version version, String componentId, String computeId, String questionnaireData);
- CompositionEntityValidationData updateCompute(ComputeEntity compute);
+ CompositionEntityValidationData updateCompute(ComputeEntity compute);
- void deleteCompute(String vspId, Version version, String componentId, String computeFlavorId);
+ void deleteCompute(String vspId, Version version, String componentId, String computeFlavorId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java
index 063bae1237..cc09e3323a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManagerFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,6 +24,6 @@ import org.openecomp.core.factory.api.AbstractComponentFactory;
public abstract class ComputeManagerFactory extends AbstractComponentFactory<ComputeManager> {
public static ComputeManagerFactory getInstance() {
- return getInstance(ComputeManagerFactory.class);
+ return getInstance(ComputeManagerFactory.class);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java
index b36c6f0864..e506bc019b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,34 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
-
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface DeploymentFlavorManager {
+ DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity);
- DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity);
-
- Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version);
-
- CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId, Version version,
- String deploymentFlavorId);
+ Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version);
- CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId,
- Version version);
+ CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId, Version version, String deploymentFlavorId);
- void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId);
+ CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId, Version version);
- CompositionEntityValidationData updateDeploymentFlavor(
- DeploymentFlavorEntity deploymentFlavorEntity);
+ void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId);
+ CompositionEntityValidationData updateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java
index 97ae62978d..cc99db62d5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManagerFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,16 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
-
import org.openecomp.core.factory.api.AbstractComponentFactory;
-public abstract class DeploymentFlavorManagerFactory extends
- AbstractComponentFactory<DeploymentFlavorManager> {
+public abstract class DeploymentFlavorManagerFactory extends AbstractComponentFactory<DeploymentFlavorManager> {
- public static DeploymentFlavorManagerFactory getInstance() {
- return getInstance(DeploymentFlavorManagerFactory.class);
- }
+ public static DeploymentFlavorManagerFactory getInstance() {
+ return getInstance(DeploymentFlavorManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java
index d1a8662821..f106c2a2ef 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -27,25 +27,21 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEnti
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface ImageManager {
- ImageEntity createImage(ImageEntity imageEntity);
- CompositionEntityResponse<Image> getImageSchema(String vspId);
+ ImageEntity createImage(ImageEntity imageEntity);
+
+ CompositionEntityResponse<Image> getImageSchema(String vspId);
- Collection<ImageEntity> listImages(String vspId, Version version, String componentId);
+ Collection<ImageEntity> listImages(String vspId, Version version, String componentId);
- CompositionEntityResponse<Image> getImage(String vspId, Version version, String componentId,
- String imageId);
+ CompositionEntityResponse<Image> getImage(String vspId, Version version, String componentId, String imageId);
- QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String componentId,
- String imageId);
+ QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String componentId, String imageId);
- void deleteImage(String vspId, Version version, String componentId, String imageId);
+ void deleteImage(String vspId, Version version, String componentId, String imageId);
- CompositionEntityValidationData updateImage(ImageEntity imageEntity);
+ CompositionEntityValidationData updateImage(ImageEntity imageEntity);
- void updateImageQuestionnaire(String vspId, Version version, String componentId, String imageId,
- String questionnaireData);
+ void updateImageQuestionnaire(String vspId, Version version, String componentId, String imageId, String questionnaireData);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java
index 2ee014bb28..1caad874f1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManagerFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,15 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
public abstract class ImageManagerFactory extends AbstractComponentFactory<ImageManager> {
- public static ImageManagerFactory getInstance() {
- return getInstance(ImageManagerFactory.class);
- }
+ public static ImageManagerFactory getInstance() {
+ return getInstance(ImageManagerFactory.class);
+ }
}
-
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java
index 4d8c861b9d..292723e1fa 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
@@ -26,7 +25,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
public interface ManualVspToscaManager {
- VspModelInfo gatherVspInformation(String vspId, Version version);
+ VspModelInfo gatherVspInformation(String vspId, Version version);
- ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo);
+ ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java
index 36f06507dc..0bc55b2ff4 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java
@@ -17,21 +17,18 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.io.InputStream;
import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.io.InputStream;
-
public interface MonitoringUploadsManager {
- void delete(String vspId, Version version, String componentId,
- MonitoringUploadType monitoringUploadType);
- void upload(InputStream object, String filename, String vspId, Version version,
- String componentId, MonitoringUploadType monitoringUploadType);
+ void delete(String vspId, Version version, String componentId, MonitoringUploadType monitoringUploadType);
+
+ void upload(InputStream object, String filename, String vspId, Version version, String componentId, MonitoringUploadType monitoringUploadType);
- MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId);
+ MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java
index 9850b2e19b..db41837222 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManagerFactory.java
@@ -17,15 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
-public abstract class MonitoringUploadsManagerFactory
- extends AbstractComponentFactory<MonitoringUploadsManager> {
+public abstract class MonitoringUploadsManagerFactory extends AbstractComponentFactory<MonitoringUploadsManager> {
- public static MonitoringUploadsManagerFactory getInstance() {
- return getInstance(MonitoringUploadsManagerFactory.class);
- }
+ public static MonitoringUploadsManagerFactory getInstance() {
+ return getInstance(MonitoringUploadsManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java
index fa740690b7..837f7803d9 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java
@@ -17,25 +17,24 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface NetworkManager {
- Collection<NetworkEntity> listNetworks(String vspId, Version version);
- NetworkEntity createNetwork(NetworkEntity network);
+ Collection<NetworkEntity> listNetworks(String vspId, Version version);
+
+ NetworkEntity createNetwork(NetworkEntity network);
- CompositionEntityValidationData updateNetwork(NetworkEntity networkEntity);
+ CompositionEntityValidationData updateNetwork(NetworkEntity networkEntity);
- CompositionEntityResponse<Network> getNetwork(String vspId, Version version, String networkId);
+ CompositionEntityResponse<Network> getNetwork(String vspId, Version version, String networkId);
- void deleteNetwork(String vspId, Version version, String networkId);
+ void deleteNetwork(String vspId, Version version, String networkId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManagerFactory.java
index a0b7465235..1c230a04bf 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManagerFactory.java
@@ -17,14 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
public abstract class NetworkManagerFactory extends AbstractComponentFactory<NetworkManager> {
- public static NetworkManagerFactory getInstance() {
- return getInstance(NetworkManagerFactory.class);
- }
+ public static NetworkManagerFactory getInstance() {
+ return getInstance(NetworkManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java
index b055d97ef3..3a600f346d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.util.Collection;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -27,24 +27,19 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEnti
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface NicManager {
- Collection<NicEntity> listNics(String vspId, Version version, String componentId);
+ Collection<NicEntity> listNics(String vspId, Version version, String componentId);
- NicEntity createNic(NicEntity nic);
+ NicEntity createNic(NicEntity nic);
- CompositionEntityValidationData updateNic(NicEntity nicEntity);
+ CompositionEntityValidationData updateNic(NicEntity nicEntity);
- CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId,
- String nicId);
+ CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId, String nicId);
- void deleteNic(String vspId, Version version, String componentId, String nicId);
+ void deleteNic(String vspId, Version version, String componentId, String nicId);
- QuestionnaireResponse getNicQuestionnaire(String vspId, Version version, String componentId,
- String nicId);
+ QuestionnaireResponse getNicQuestionnaire(String vspId, Version version, String componentId, String nicId);
- void updateNicQuestionnaire(String vspId, Version version, String componentId, String nicId,
- String questionnaireData);
+ void updateNicQuestionnaire(String vspId, Version version, String componentId, String nicId, String questionnaireData);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManagerFactory.java
index 212619ce87..2749fee17f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManagerFactory.java
@@ -17,14 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
public abstract class NicManagerFactory extends AbstractComponentFactory<NicManager> {
- public static NicManagerFactory getInstance() {
- return getInstance(NicManagerFactory.class);
- }
+ public static NicManagerFactory getInstance() {
+ return getInstance(NicManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java
index 5cf66874c4..f1c6aa5209 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import java.io.IOException;
@@ -30,18 +29,17 @@ import org.openecomp.sdc.versioning.dao.types.Version;
public interface OrchestrationTemplateCandidateManager {
- OrchestrationTemplateActionResponse process(String vspId, Version version);
+ OrchestrationTemplateActionResponse process(String vspId, Version version);
- Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version);
+ Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version);
- ValidationResponse updateFilesDataStructure(String vspId, Version version,
- FilesDataStructure fileDataStructure);
+ ValidationResponse updateFilesDataStructure(String vspId, Version version, FilesDataStructure fileDataStructure);
- Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException;
+ Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException;
- Optional<OrchestrationTemplateCandidateData> getInfo(String vspId, Version version);
+ Optional<OrchestrationTemplateCandidateData> getInfo(String vspId, Version version);
- void abort(String vspId, Version version);
+ void abort(String vspId, Version version);
- UploadFileResponse upload(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo);
+ UploadFileResponse upload(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManagerFactory.java
index b38355b8e9..8a5fe05d0d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManagerFactory.java
@@ -17,15 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
-public abstract class OrchestrationTemplateCandidateManagerFactory
- extends AbstractComponentFactory<OrchestrationTemplateCandidateManager> {
+public abstract class OrchestrationTemplateCandidateManagerFactory extends AbstractComponentFactory<OrchestrationTemplateCandidateManager> {
- public static OrchestrationTemplateCandidateManagerFactory getInstance() {
- return getInstance(OrchestrationTemplateCandidateManagerFactory.class);
- }
+ public static OrchestrationTemplateCandidateManagerFactory getInstance() {
+ return getInstance(OrchestrationTemplateCandidateManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManager.java
index 979eea0fb8..c10a4c733c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManager.java
@@ -17,33 +17,31 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
import java.io.File;
import java.io.InputStream;
import java.util.Collection;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
public interface ProcessManager {
- Collection<ProcessEntity> listProcesses(String vspId, Version version, String componentId);
- void deleteProcesses(String vspId, Version version, String componentId);
+ Collection<ProcessEntity> listProcesses(String vspId, Version version, String componentId);
+
+ void deleteProcesses(String vspId, Version version, String componentId);
- ProcessEntity createProcess(ProcessEntity processEntity);
+ ProcessEntity createProcess(ProcessEntity processEntity);
- ProcessEntity getProcess(String vspId, Version version, String componentId, String processId);
+ ProcessEntity getProcess(String vspId, Version version, String componentId, String processId);
- void updateProcess(ProcessEntity processEntity);
+ void updateProcess(ProcessEntity processEntity);
- void deleteProcess(String vspId, Version version, String componentId, String processId);
+ void deleteProcess(String vspId, Version version, String componentId, String processId);
- File getProcessArtifact(String vspId, Version version, String componentId, String processId);
+ File getProcessArtifact(String vspId, Version version, String componentId, String processId);
- void deleteProcessArtifact(String vspId, Version version, String componentId, String processId);
+ void deleteProcessArtifact(String vspId, Version version, String componentId, String processId);
- void uploadProcessArtifact(InputStream uploadFile, String fileName, String vspId,
- Version version, String componentId, String processId);
+ void uploadProcessArtifact(InputStream uploadFile, String fileName, String vspId, Version version, String componentId, String processId);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManagerFactory.java
index f8d1038ca2..578e36778e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManagerFactory.java
@@ -17,14 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
public abstract class ProcessManagerFactory extends AbstractComponentFactory<ProcessManager> {
- public static ProcessManagerFactory getInstance() {
- return getInstance(ProcessManagerFactory.class);
- }
+ public static ProcessManagerFactory getInstance() {
+ return getInstance(ProcessManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
index 2339fa0921..6a92dbb209 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
@@ -13,9 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
@@ -27,13 +32,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
public interface VendorSoftwareProductManager {
VspDetails createVsp(VspDetails vspDetails);
@@ -48,12 +46,10 @@ public interface VendorSoftwareProductManager {
Map<String, List<ErrorMessage>> compile(String vspId, Version version);
-
QuestionnaireResponse getVspQuestionnaire(String vspId, Version version);
void updateVspQuestionnaire(String vspId, Version version, String questionnaireData);
-
byte[] getOrchestrationTemplateFile(String vspId, Version version);
OrchestrationTemplateEntity getOrchestrationTemplateInfo(String vspId, Version version);
@@ -64,7 +60,6 @@ public interface VendorSoftwareProductManager {
List<PackageInfo> listPackages(String category, String subCategory);
-
File getTranslatedFile(String vspId, Version version);
File getInformationArtifact(String vspId, Version version);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VspManagerFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VspManagerFactory.java
index a2f186428a..ac03524a12 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VspManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VspManagerFactory.java
@@ -17,15 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct;
import org.openecomp.core.factory.api.AbstractComponentFactory;
-public abstract class VspManagerFactory
- extends AbstractComponentFactory<VendorSoftwareProductManager> {
+public abstract class VspManagerFactory extends AbstractComponentFactory<VendorSoftwareProductManager> {
- public static VspManagerFactory getInstance() {
- return getInstance(VspManagerFactory.class);
- }
+ public static VspManagerFactory getInstance() {
+ return getInstance(VspManagerFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentDependencyModelErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentDependencyModelErrorBuilder.java
index 249ad1cb28..c3869198b1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentDependencyModelErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentDependencyModelErrorBuilder.java
@@ -13,60 +13,55 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.CYCLIC_DEPENDENCY_IN_COMPONENTS;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_COMPONENT_RELATION_TYPE;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NO_SOURCE_COMPONENT;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.SAME_SOURCE_TARGET_COMPONENT;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.*;
-
public class ComponentDependencyModelErrorBuilder {
- private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
- + " components.";
-
- private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
-
- private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
-
- private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
- + "are same.";
-
- private ComponentDependencyModelErrorBuilder(){
+ private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between" + " components.";
+ private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
+ private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
+ private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components " + "are same.";
- }
+ private ComponentDependencyModelErrorBuilder() {
+ }
- public static ErrorCode getCyclicDependencyComponentErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(CYCLIC_DEPENDENCY_IN_COMPONENTS);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(CYCLIC_DEPENDENCY_COMPONENT_MSG);
- return builder.build();
- }
+ public static ErrorCode getCyclicDependencyComponentErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(CYCLIC_DEPENDENCY_IN_COMPONENTS);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(CYCLIC_DEPENDENCY_COMPONENT_MSG);
+ return builder.build();
+ }
- public static ErrorCode getInvalidRelationTypeErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(INVALID_COMPONENT_RELATION_TYPE);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(INVALID_REALTION_TYPE_MSG);
- return builder.build();
- }
+ public static ErrorCode getInvalidRelationTypeErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(INVALID_COMPONENT_RELATION_TYPE);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(INVALID_REALTION_TYPE_MSG);
+ return builder.build();
+ }
- public static ErrorCode getNoSourceComponentErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(NO_SOURCE_COMPONENT);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(NO_SOURCE_COMPONENT_MSG);
- return builder.build();
- }
+ public static ErrorCode getNoSourceComponentErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(NO_SOURCE_COMPONENT);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(NO_SOURCE_COMPONENT_MSG);
+ return builder.build();
+ }
- public static ErrorCode getSourceTargetComponentEqualErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(SAME_SOURCE_TARGET_COMPONENT);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(SOURCE_TARGET_COMPONENT_EQUAL_MSG);
- return builder.build();
- }
+ public static ErrorCode getSourceTargetComponentEqualErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(SAME_SOURCE_TARGET_COMPONENT);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(SOURCE_TARGET_COMPONENT_EQUAL_MSG);
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java
index 74f4fd2a13..0271020c09 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java
@@ -13,28 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-
public class ComponentErrorBuilder {
- private static final String VFC_INVALID_MISSING_IMAGE_MSG =
- "All VFC need to have atleast a single Image specified. Please fix the VFC Images and re-submit the VSP";
-
- private ComponentErrorBuilder(){
-
- }
+ private static final String VFC_INVALID_MISSING_IMAGE_MSG = "All VFC need to have atleast a single Image specified. Please fix the VFC Images and re-submit the VSP";
+ private ComponentErrorBuilder() {
+ }
- public static ErrorCode vfcMissingImageErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VendorSoftwareProductErrorCodes.VFC_INVALID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(VFC_INVALID_MISSING_IMAGE_MSG);
- return builder.build();
- }
+ public static ErrorCode vfcMissingImageErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(VendorSoftwareProductErrorCodes.VFC_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(VFC_INVALID_MISSING_IMAGE_MSG);
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CompositionEditNotAllowedErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CompositionEditNotAllowedErrorBuilder.java
index 4e4de2279e..fbb25dc3b3 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CompositionEditNotAllowedErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CompositionEditNotAllowedErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,41 +17,37 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.dao.types.Version;
-
public class CompositionEditNotAllowedErrorBuilder {
- private static final String VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG =
- "Composition entities may not be created / deleted for Vendor Software Product %s, version %s"
- + "whose entities were uploaded";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- */
- public CompositionEditNotAllowedErrorBuilder(String vendorSoftwareProductId, Version version) {
- builder.withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(
- String.format(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG, vendorSoftwareProductId,
- version == null ? null : version.toString()));
+ private static final String VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG =
+ "Composition entities may not be created / deleted for Vendor Software Product %s, version %s" + "whose entities were uploaded";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- }
+ /**
+ * Instantiates a new error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ */
+ public CompositionEditNotAllowedErrorBuilder(String vendorSoftwareProductId, Version version) {
+ builder.withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder
+ .withMessage(String.format(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG, vendorSoftwareProductId, version == null ? null : version.toString()));
+ }
- /**
- * Build error code.
- *
- * @return the error code
- */
- public ErrorCode build() {
- return builder.build();
- }
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java
index 5250b971ac..83cc92c119 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -23,11 +22,10 @@ import org.openecomp.sdc.common.errors.ErrorCode;
* The Compute error builder.
*/
public class ComputeErrorBuilder {
- private static final String COMPUTE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria"
- + ": name : must match %s";
- private ComputeErrorBuilder(){
+ private static final String COMPUTE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + ": name : must match %s";
+ private ComputeErrorBuilder() {
}
/**
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java
index 04038fe6bc..39752b39e7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,38 +17,34 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.CREATE_PACKAGE_FOR_NON_FINAL_VSP;
+
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.dao.types.Version;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.CREATE_PACKAGE_FOR_NON_FINAL_VSP;
-
-
public class CreatePackageForNonFinalVendorSoftwareProductErrorBuilder {
- private static final String CREATE_PACKAGE_FOR_NON_FINAL_VSP_MSG =
- "Package creation for vendor software product with id %s and version %s is not allowed since "
- + "it is not final (submitted).";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
-
- /**
- * Instantiates a new Create package for non final vendor software product error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- */
- public CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(String vendorSoftwareProductId,
- Version version) {
- builder.withId(CREATE_PACKAGE_FOR_NON_FINAL_VSP);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String
- .format(CREATE_PACKAGE_FOR_NON_FINAL_VSP_MSG, vendorSoftwareProductId, version == null ? null : version.toString()));
- }
-
- public ErrorCode build() {
- return builder.build();
- }
+ private static final String CREATE_PACKAGE_FOR_NON_FINAL_VSP_MSG =
+ "Package creation for vendor software product with id %s and version %s is not allowed since " + "it is not final (submitted).";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Create package for non final vendor software product error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ */
+ public CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(String vendorSoftwareProductId, Version version) {
+ builder.withId(CREATE_PACKAGE_FOR_NON_FINAL_VSP);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder
+ .withMessage(String.format(CREATE_PACKAGE_FOR_NON_FINAL_VSP_MSG, vendorSoftwareProductId, version == null ? null : version.toString()));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java
index 6a94d81643..61ad90185f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java
@@ -13,18 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
public class DeleteNicErrorBuilder {
- private static final String DELETE_NIC_NOT_ALLOWED_MSG =
- "NIC cannot be deleted for VSPs onboarded with HEAT.";
- private DeleteNicErrorBuilder(){
+ private static final String DELETE_NIC_NOT_ALLOWED_MSG = "NIC cannot be deleted for VSPs onboarded with HEAT.";
+ private DeleteNicErrorBuilder() {
}
public static ErrorCode getDeleteNicForHeatOnboardedVspErrorBuilder() {
@@ -34,5 +32,4 @@ public class DeleteNicErrorBuilder {
builder.withMessage(String.format(DELETE_NIC_NOT_ALLOWED_MSG));
return builder.build();
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java
index ab0881268e..4869b77bc6 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java
@@ -13,43 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.versioning.dao.types.Version;
public class DeploymentFlavorErrorBuilder {
- private static final String CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
- "Deployment Flavor cannot be added for VSPs onboarded with HEAT.";
- private static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG =
- "Invalid request, Feature Group provided does not exist for this Vsp.";
- private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG
- = "Invalid request,for valid association please provide ComponentId for Compute Flavor";
- private static final String SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG =
- "Invalid Request,Same Vfc cannot be associated more than once.";
- private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG =
- "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s.";
- private static final String DEPLOYMENT_FLAVOUR_NAME_FORMAT_MSG = "Field does not conform to predefined criteria"
- + ": name : must match %s";
- private static final String INVALID_COMPUTE_FLAVOR_ID_MSG =
- "Invalid request, Compute Flavor provided does not exist for this VFC.";
- private static final String INVALID_COMPONENT_ID_MSG =
- "Invalid request, Component provided does not exist for this VSP.";
- private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG="VSP cannot be " +
- "submitted with an invalid Deployment Flavor. All Deployment Flavor should have atleast a VFC included with it's required Compute needs. " +
- "Please fix the Deployment Flavor %s and re-submit the VSP.";
-
- private static final String FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG = "VSP cannot be " +
- "submitted with an invalid Deployment Flavor. All Deployment Flavor should have " +
- "FeatureGroup. Please fix the Deployment Flavor %s and re-submit the VSP.";
-
- private DeploymentFlavorErrorBuilder(){
+ private static final String CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = "Deployment Flavor cannot be added for VSPs onboarded with HEAT.";
+ private static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG = "Invalid request, Feature Group provided does not exist for this Vsp.";
+ private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG = "Invalid request,for valid association please provide ComponentId for Compute Flavor";
+ private static final String SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG = "Invalid Request,Same Vfc cannot be associated more than once.";
+ private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG = "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s.";
+ private static final String DEPLOYMENT_FLAVOUR_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + ": name : must match %s";
+ private static final String INVALID_COMPUTE_FLAVOR_ID_MSG = "Invalid request, Compute Flavor provided does not exist for this VFC.";
+ private static final String INVALID_COMPONENT_ID_MSG = "Invalid request, Component provided does not exist for this VSP.";
+ private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG = "VSP cannot be "
+ + "submitted with an invalid Deployment Flavor. All Deployment Flavor should have atleast a VFC included with it's required Compute needs. "
+ + "Please fix the Deployment Flavor %s and re-submit the VSP.";
+ private static final String FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG =
+ "VSP cannot be " + "submitted with an invalid Deployment Flavor. All Deployment Flavor should have "
+ + "FeatureGroup. Please fix the Deployment Flavor %s and re-submit the VSP.";
+
+ private DeploymentFlavorErrorBuilder() {
}
- public static ErrorCode getAddDeploymentNotSupportedHeatOnboardErrorBuilder(){
+ public static ErrorCode getAddDeploymentNotSupportedHeatOnboardErrorBuilder() {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
builder.withId(VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
builder.withCategory(ErrorCategory.APPLICATION);
@@ -57,7 +46,7 @@ public class DeploymentFlavorErrorBuilder {
return builder.build();
}
- public static ErrorCode getFeatureGroupNotexistErrorBuilder(){
+ public static ErrorCode getFeatureGroupNotexistErrorBuilder() {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
builder.withId(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP);
builder.withCategory(ErrorCategory.APPLICATION);
@@ -65,10 +54,9 @@ public class DeploymentFlavorErrorBuilder {
return builder.build();
}
- public static ErrorCode getDuplicateVfcAssociationErrorBuilder(){
+ public static ErrorCode getDuplicateVfcAssociationErrorBuilder() {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VendorSoftwareProductErrorCodes
- .SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED);
+ builder.withId(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED);
builder.withCategory(ErrorCategory.APPLICATION);
builder.withMessage(SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG);
return builder.build();
@@ -82,12 +70,11 @@ public class DeploymentFlavorErrorBuilder {
return builder.build();
}
- public static ErrorCode getDuplicateDeploymentFlavorModelErrorBuilder(String name,
- String vspId) {
+ public static ErrorCode getDuplicateDeploymentFlavorModelErrorBuilder(String name, String vspId) {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED);
builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG,name,vspId));
+ builder.withMessage(String.format(DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG, name, vspId));
return builder.build();
}
@@ -123,7 +110,7 @@ public class DeploymentFlavorErrorBuilder {
return builder.build();
}
- public static ErrorCode getDeploymentFlavorNameFormatErrorBuilder(String pattern){
+ public static ErrorCode getDeploymentFlavorNameFormatErrorBuilder(String pattern) {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
builder.withId(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED);
builder.withCategory(ErrorCategory.APPLICATION);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java
index 553ee920a4..4915912313 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,31 +17,27 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
-import org.openecomp.sdc.common.errors.ErrorCategory;
-import org.openecomp.sdc.common.errors.ErrorCode;
-
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
public class DuplicateComputeInComponentErrorBuilder {
- private static final String COMPUTE_HEAT_READONLY_ATTR_MSG =
- "Update of attribute %s not allowed for VSP onboarded via HEAT.";
-
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- public static ErrorCode getComputeHeatReadOnlyErrorBuilder(String name) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(UPDATE_COMPUTE_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(COMPUTE_HEAT_READONLY_ATTR_MSG, name));
- return builder.build();
- }
+ private static final String COMPUTE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed for VSP onboarded via HEAT.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ public static ErrorCode getComputeHeatReadOnlyErrorBuilder(String name) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(UPDATE_COMPUTE_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(COMPUTE_HEAT_READONLY_ATTR_MSG, name));
+ return builder.build();
+ }
- public ErrorCode build() {
- return builder.build();
- }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java
index 6d5edff169..0ff6e228eb 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -25,18 +24,16 @@ import org.openecomp.sdc.common.errors.ErrorCode;
public class DuplicateNicInComponentErrorBuilder {
- private static final String DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG =
- "Invalid request, NIC with name %s already exist for component with ID %s.";
-
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ private static final String DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG = "Invalid request, NIC with name %s already exist for component with ID %s.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- public DuplicateNicInComponentErrorBuilder(String nicName, String componentId ){
- builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG,nicName,componentId));
- }
- public ErrorCode build() {
- return builder.build();
- }
+ public DuplicateNicInComponentErrorBuilder(String nicName, String componentId) {
+ builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG, nicName, componentId));
+ }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java
index e00e145020..75388af64a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,33 +17,31 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.HEAT_PACKAGE_FILE_CREATION;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.HEAT_PACKAGE_FILE_CREATION;
-
public class FileCreationErrorBuilder {
- private static final String HEAT_PKG_FILE_CREATION_ERROR_MSG =
- "Error while trying to create heat file from the package of vendor software product "
- + "with Id %s.";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new File creation error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- */
- public FileCreationErrorBuilder(String vendorSoftwareProductId) {
- builder.withId(HEAT_PACKAGE_FILE_CREATION);
- builder.withCategory(ErrorCategory.SYSTEM);
- builder.withMessage(String.format(HEAT_PKG_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId));
- }
+ private static final String HEAT_PKG_FILE_CREATION_ERROR_MSG =
+ "Error while trying to create heat file from the package of vendor software product " + "with Id %s.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new File creation error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ */
+ public FileCreationErrorBuilder(String vendorSoftwareProductId) {
+ builder.withId(HEAT_PACKAGE_FILE_CREATION);
+ builder.withCategory(ErrorCategory.SYSTEM);
+ builder.withMessage(String.format(HEAT_PKG_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId));
+ }
- public ErrorCode build() {
- return builder.build();
- }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java
index 45bad9cad9..c5beb04a47 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java
@@ -13,90 +13,89 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_NAME_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_VERSION_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT;
+
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.*;
-
/**
* The Image error builder.
*/
public class ImageErrorBuilder {
- private static final String VFC_IMAGE_DUPLICATE_NAME_MSG = "Invalid request, Image with name %s"
- + " already exists for component with ID %s.";
- private static final String VFC_IMAGE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria"
- + ": name : must match %s";
- private static final String IMAGE_INVALID_FORMAT_MSG = "The format value doesn't meet the "
- + "expected attribute value.";
+ private static final String VFC_IMAGE_DUPLICATE_NAME_MSG = "Invalid request, Image with name %s" + " already exists for component with ID %s.";
+ private static final String VFC_IMAGE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + ": name : must match %s";
+ private static final String IMAGE_INVALID_FORMAT_MSG = "The format value doesn't meet the " + "expected attribute value.";
+ private static final String IMAGE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed " + "for VSP onboarded via HEAT.";
+ private static final String VFC_IMAGE_DUPLICATE_VERSION_MSG =
+ "Invalid request, Image with version %s" + " already exists for component with ID %s.";
- private static final String IMAGE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed "
- + "for VSP onboarded via HEAT.";
- private static final String VFC_IMAGE_DUPLICATE_VERSION_MSG = "Invalid request, Image with version %s"
- + " already exists for component with ID %s.";
- private ImageErrorBuilder() {
+ private ImageErrorBuilder() {
+ }
- }
+ /**
+ * Gets duplicate image name error builder.
+ *
+ * @return the duplicate image name error builder
+ */
+ public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componentId) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(DUPLICATE_IMAGE_NAME_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componentId));
+ return builder.build();
+ }
- /**
- * Gets duplicate image name error builder.
- *
- * @return the duplicate image name error builder
- */
- public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componentId) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(DUPLICATE_IMAGE_NAME_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componentId ));
- return builder.build();
- }
+ /**
+ * Gets duplicate image version error builder.
+ *
+ * @return the duplicate image version error builder
+ */
+ public static ErrorCode getDuplicateImageVersionErrorBuilder(String version, String componentId) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(DUPLICATE_IMAGE_VERSION_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_VERSION_MSG, version, componentId));
+ return builder.build();
+ }
- /**
- * Gets duplicate image version error builder.
- *
- * @return the duplicate image version error builder
- */
- public static ErrorCode getDuplicateImageVersionErrorBuilder(String version, String componentId) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(DUPLICATE_IMAGE_VERSION_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_VERSION_MSG, version, componentId ));
- return builder.build();
- }
- /**
- * Gets image name format error builder.
- *
- * @return the image name format error builder
- */
- public static ErrorCode getImageNameFormatErrorBuilder(String pattern) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(IMAGE_NAME_FORMAT_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VFC_IMAGE_NAME_FORMAT_MSG, pattern));
- return builder.build();
- }
+ /**
+ * Gets image name format error builder.
+ *
+ * @return the image name format error builder
+ */
+ public static ErrorCode getImageNameFormatErrorBuilder(String pattern) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(IMAGE_NAME_FORMAT_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(VFC_IMAGE_NAME_FORMAT_MSG, pattern));
+ return builder.build();
+ }
- /**
- * Gets invalid image format error builder.
- *
- * @return the invalid image format error builder
- */
- public static ErrorCode getInvalidImageFormatErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VFC_IMAGE_INVALID_FORMAT);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(IMAGE_INVALID_FORMAT_MSG);
- return builder.build();
- }
+ /**
+ * Gets invalid image format error builder.
+ *
+ * @return the invalid image format error builder
+ */
+ public static ErrorCode getInvalidImageFormatErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(VFC_IMAGE_INVALID_FORMAT);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(IMAGE_INVALID_FORMAT_MSG);
+ return builder.build();
+ }
- public static ErrorCode getImageHeatReadOnlyErrorBuilder(String name) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(UPDATE_IMAGE_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(IMAGE_HEAT_READONLY_ATTR_MSG, name));
- return builder.build();
- }
+ public static ErrorCode getImageHeatReadOnlyErrorBuilder(String name) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(UPDATE_IMAGE_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(IMAGE_HEAT_READONLY_ATTR_MSG, name));
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/InformationArtifactCreationErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/InformationArtifactCreationErrorBuilder.java
index ca5b9bfcbb..e5acffe868 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/InformationArtifactCreationErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/InformationArtifactCreationErrorBuilder.java
@@ -17,31 +17,28 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
-import org.openecomp.sdc.common.errors.ErrorCategory;
-import org.openecomp.sdc.common.errors.ErrorCode;
-
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.HEAT_PACKAGE_FILE_CREATION;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
/**
* Created by Talio on 11/24/2016.
*/
public class InformationArtifactCreationErrorBuilder {
- private static final String INFO_ARTIFACT_FILE_CREATION_ERROR_MSG =
- "Error while trying to information artifact file for vendor software product with Id %s.";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- public InformationArtifactCreationErrorBuilder(String vendorSoftwareProductId) {
- builder.withId(HEAT_PACKAGE_FILE_CREATION);
- builder.withCategory(ErrorCategory.SYSTEM);
- builder
- .withMessage(String.format(INFO_ARTIFACT_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId));
- }
+ private static final String INFO_ARTIFACT_FILE_CREATION_ERROR_MSG = "Error while trying to information artifact file for vendor software product with Id %s.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ public InformationArtifactCreationErrorBuilder(String vendorSoftwareProductId) {
+ builder.withId(HEAT_PACKAGE_FILE_CREATION);
+ builder.withCategory(ErrorCategory.SYSTEM);
+ builder.withMessage(String.format(INFO_ARTIFACT_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId));
+ }
- public ErrorCode build() {
- return builder.build();
- }
-} \ No newline at end of file
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java
index eed56e1a1a..0c5fb45380 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,43 +17,40 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.MONITORING_UPLOAD_INVALID;
+
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.versioning.dao.types.Version;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.MONITORING_UPLOAD_INVALID;
-
public class MonitoringUploadErrorBuilder extends BaseErrorBuilder {
- private static final String UPLOAD_INVALID_DETAILED_MSG =
- "Monitoring file uploaded for vendor software product with Id %s and version %s is invalid: %s";
+ private static final String UPLOAD_INVALID_DETAILED_MSG = "Monitoring file uploaded for vendor software product with Id %s and version %s is invalid: %s";
- /**
- * Instantiates a new Mib upload error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- * @param error the error
- */
- public MonitoringUploadErrorBuilder(String vendorSoftwareProductId, Version version,
- String error) {
- getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(String.format(UPLOAD_INVALID_DETAILED_MSG,
- vendorSoftwareProductId, version == null ? null : version.getId(), error));
- }
+ /**
+ * Instantiates a new Mib upload error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ * @param error the error
+ */
+ public MonitoringUploadErrorBuilder(String vendorSoftwareProductId, Version version, String error) {
+ getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder()
+ .withMessage(String.format(UPLOAD_INVALID_DETAILED_MSG, vendorSoftwareProductId, version == null ? null : version.getId(), error));
+ }
- /**
- * Instantiates a new Mib upload error builder.
- *
- * @param errorMessage the error message
- */
- public MonitoringUploadErrorBuilder(String errorMessage) {
- getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(errorMessage);
- }
+ /**
+ * Instantiates a new Mib upload error builder.
+ *
+ * @param errorMessage the error message
+ */
+ public MonitoringUploadErrorBuilder(String errorMessage) {
+ getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(errorMessage);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java
index 5eb7520a38..0d63222cf5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,23 +17,21 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED;
+
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED;
-
/**
* The NIC error builder.
*/
public class NicErrorBuilder {
- private static final String NIC_NAME_FORMAT_MSG = "Field does not conform to predefined criteria"
- + ": name : must match %s";
- private NicErrorBuilder() {
+ private static final String NIC_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + ": name : must match %s";
+ private NicErrorBuilder() {
}
/**
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java
index 5e7d8b98e3..69fabbc89f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java
@@ -13,54 +13,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
-import org.openecomp.sdc.common.errors.ErrorCategory;
-import org.openecomp.sdc.common.errors.ErrorCode;
-
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_TYPE_UPDATE_NOT_ALLOWED;
-public class NicInternalNetworkErrorBuilder {
- private static final String NULL_NETWORKID_NOT_ALLOWED_MSG =
- "Internal Networks are currently not supported for VSP created Manually, so please fix all the NIC to be of Type External and re-submit the VSP.";
-
- private static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG =
- "Invalid request, Network Description not allowed for Internal Networks";
- private static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG =
- "Invalid request, Network Type Update not allowed for a Nic";
-
- private NicInternalNetworkErrorBuilder() {
-
- }
-
-
- public static ErrorCode getNicNullNetworkIdInternalNetworkIdErrorBuilder(){
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VendorSoftwareProductErrorCodes.NULL_NETWORKID_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(NULL_NETWORKID_NOT_ALLOWED_MSG);
- return builder.build();
- }
-
-
- public static ErrorCode getNetworkDescriptionInternalNetworkErrorBuilder(){
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG);
- return builder.build();
- }
-
-
- public static ErrorCode getNetworkTypeErrorBuilder(){
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(NETWORK_TYPE_UPDATE_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG);
- return builder.build();
- }
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+public class NicInternalNetworkErrorBuilder {
+ private static final String NULL_NETWORKID_NOT_ALLOWED_MSG = "Internal Networks are currently not supported for VSP created Manually, so please fix all the NIC to be of Type External and re-submit the VSP.";
+ private static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG = "Invalid request, Network Description not allowed for Internal Networks";
+ private static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG = "Invalid request, Network Type Update not allowed for a Nic";
+
+ private NicInternalNetworkErrorBuilder() {
+ }
+
+ public static ErrorCode getNicNullNetworkIdInternalNetworkIdErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(VendorSoftwareProductErrorCodes.NULL_NETWORKID_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(NULL_NETWORKID_NOT_ALLOWED_MSG);
+ return builder.build();
+ }
+
+ public static ErrorCode getNetworkDescriptionInternalNetworkErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG);
+ return builder.build();
+ }
+
+ public static ErrorCode getNetworkTypeErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(NETWORK_TYPE_UPDATE_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG);
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java
index c40fdee62d..df7e9b30a7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,23 +17,23 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
public class NicNetworkIdNotAllowedExternalNetworkErrorBuilder {
- private static final String NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG =
- "Invalid request,NetworkId not allowed for External Networks";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- public NicNetworkIdNotAllowedExternalNetworkErrorBuilder(){
- builder.withId(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG));
- }
- public ErrorCode build() {
- return builder.build();
- }
+ private static final String NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG = "Invalid request,NetworkId not allowed for External Networks";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ public NicNetworkIdNotAllowedExternalNetworkErrorBuilder() {
+ builder.withId(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java
index 14bfe8827d..328bd87269 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java
@@ -13,79 +13,75 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_IMAGE_NOT_ALLOWED;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
+
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.*;
-
public class NotSupportedHeatOnboardMethodErrorBuilder {
- private static final String ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
- "NIC cannot be added for VSPs onboarded with HEAT.";
- private static final String ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
- "Compute flavor cannot be added for VSPs onboarded with HEAT.";
- private static final String IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
- "Image cannot be added for VSPs onboarded with HEAT.";
- private static final String DELETE_IMAGE_NOT_ALLOWED_MSG =
- "Image cannot be deleted for VSPs onboarded with HEAT.";
- private static final String DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG =
- "Deployment Flavor cannot be deleted for VSPs onboarded with HEAT.";
- private static final String EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG =
- "Deployment Flavor cannot be edited for VSPs onboarded with HEAT.";
-
- private NotSupportedHeatOnboardMethodErrorBuilder() {
-
- }
+ private static final String ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = "NIC cannot be added for VSPs onboarded with HEAT.";
+ private static final String ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = "Compute flavor cannot be added for VSPs onboarded with HEAT.";
+ private static final String IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = "Image cannot be added for VSPs onboarded with HEAT.";
+ private static final String DELETE_IMAGE_NOT_ALLOWED_MSG = "Image cannot be deleted for VSPs onboarded with HEAT.";
+ private static final String DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG = "Deployment Flavor cannot be deleted for VSPs onboarded with HEAT.";
+ private static final String EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG = "Deployment Flavor cannot be edited for VSPs onboarded with HEAT.";
- public static ErrorCode getAddNicNotSupportedHeatOnboardMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
- return builder.build();
- }
+ private NotSupportedHeatOnboardMethodErrorBuilder() {
+ }
- public static ErrorCode getAddComputeNotSupportedHeatOnboardMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
- return builder.build();
- }
+ public static ErrorCode getAddNicNotSupportedHeatOnboardMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
+ return builder.build();
+ }
- public static ErrorCode getAddImageNotSupportedHeatOnboardMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
- return builder.build();
- }
+ public static ErrorCode getAddComputeNotSupportedHeatOnboardMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
+ return builder.build();
+ }
- public static ErrorCode getDelImageNotSupportedHeatOnboardMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(DELETE_IMAGE_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(DELETE_IMAGE_NOT_ALLOWED_MSG);
- return builder.build();
- }
+ public static ErrorCode getAddImageNotSupportedHeatOnboardMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
+ return builder.build();
+ }
- public static ErrorCode getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG);
- return builder.build();
- }
+ public static ErrorCode getDelImageNotSupportedHeatOnboardMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(DELETE_IMAGE_NOT_ALLOWED);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(DELETE_IMAGE_NOT_ALLOWED_MSG);
+ return builder.build();
+ }
- public static ErrorCode getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG);
- return builder.build();
- }
+ public static ErrorCode getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG);
+ return builder.build();
+ }
+ public static ErrorCode getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG);
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java
index b30455156c..c7f130dd67 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java
@@ -13,36 +13,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_INVALID_ONBOARDING_METHOD;
+
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_INVALID_ONBOARDING_METHOD;
-
/**
* The type Onboarding method error builder.
*/
public class OnboardingMethodErrorBuilder {
- private static final String VSP_INVALID_ONBOARDING_METHOD_MSG =
- "The onboardingMethod value doesn't meet the expected attribute value.";
+ private static final String VSP_INVALID_ONBOARDING_METHOD_MSG = "The onboardingMethod value doesn't meet the expected attribute value.";
- private OnboardingMethodErrorBuilder() {
-
- }
+ private OnboardingMethodErrorBuilder() {
+ }
- /**
- * Get invalid onboarding method error builder error code.
- *
- * @return the error code
- */
- public static ErrorCode getInvalidOnboardingMethodErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VSP_INVALID_ONBOARDING_METHOD);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(VSP_INVALID_ONBOARDING_METHOD_MSG);
- return builder.build();
- }
+ /**
+ * Get invalid onboarding method error builder error code.
+ *
+ * @return the error code
+ */
+ public static ErrorCode getInvalidOnboardingMethodErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(VSP_INVALID_ONBOARDING_METHOD);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(VSP_INVALID_ONBOARDING_METHOD_MSG);
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OrchestrationTemplateNotFoundErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OrchestrationTemplateNotFoundErrorBuilder.java
index 84ce956911..3c6d611389 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OrchestrationTemplateNotFoundErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OrchestrationTemplateNotFoundErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,32 +17,29 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ORCHESTRATION_NOT_FOUND;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ORCHESTRATION_NOT_FOUND;
-
public class OrchestrationTemplateNotFoundErrorBuilder {
- private static final String ORCHESTRATION_TEMPLATE_NOT_FOUND_MESSAGE =
- "Failed to get orchestration template for VSP with id %s";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new Orchestration template not found error builder.
- *
- * @param vspId the vsp id
- */
- public OrchestrationTemplateNotFoundErrorBuilder(String vspId) {
- builder.withId(ORCHESTRATION_NOT_FOUND)
- .withCategory(ErrorCategory.APPLICATION)
- .withMessage(String.format(ORCHESTRATION_TEMPLATE_NOT_FOUND_MESSAGE, vspId));
- }
+ private static final String ORCHESTRATION_TEMPLATE_NOT_FOUND_MESSAGE = "Failed to get orchestration template for VSP with id %s";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Orchestration template not found error builder.
+ *
+ * @param vspId the vsp id
+ */
+ public OrchestrationTemplateNotFoundErrorBuilder(String vspId) {
+ builder.withId(ORCHESTRATION_NOT_FOUND).withCategory(ErrorCategory.APPLICATION)
+ .withMessage(String.format(ORCHESTRATION_TEMPLATE_NOT_FOUND_MESSAGE, vspId));
+ }
- public ErrorCode build() {
- return builder.build();
- }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java
index ce9794aa3b..c0e4557f3a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,44 +17,41 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.PACKAGE_INVALID;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.dao.types.Version;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.PACKAGE_INVALID;
-
/**
* The type Package invalid error builder.
*/
public class PackageInvalidErrorBuilder {
- private static final String PACKAGE_INVALID_MSG =
- "Package for vendor software product with Id %s and version %s is invalid "
- + "(does not contain translated data).";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new Package invalid error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- */
- public PackageInvalidErrorBuilder(String vendorSoftwareProductId, Version version) {
- builder.withId(PACKAGE_INVALID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(PACKAGE_INVALID_MSG,
- vendorSoftwareProductId, version == null ? null : version.toString()));
- }
+ private static final String PACKAGE_INVALID_MSG =
+ "Package for vendor software product with Id %s and version %s is invalid " + "(does not contain translated data).";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Package invalid error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ */
+ public PackageInvalidErrorBuilder(String vendorSoftwareProductId, Version version) {
+ builder.withId(PACKAGE_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(PACKAGE_INVALID_MSG, vendorSoftwareProductId, version == null ? null : version.toString()));
+ }
- /**
- * Build error code.
- *
- * @return the error code
- */
- public ErrorCode build() {
- return builder.build();
- }
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java
index 54ae9ce398..ef80e4d8db 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -25,37 +24,35 @@ import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.dao.types.Version;
public class PackageNotFoundErrorBuilder {
- private static final String PACKAGE_VERSION_NOT_FOUND_MSG =
- "Package for vendor software product with Id %s and version %s does not exist.";
- private static final String PACKAGE_NOT_FOUND_MSG =
- "Package for vendor software product with Id %s does not exist.";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new Package not found error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- */
- public PackageNotFoundErrorBuilder(String vendorSoftwareProductId, Version version) {
- builder.withId(VendorSoftwareProductErrorCodes.PACKAGE_NOT_FOUND);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(PACKAGE_VERSION_NOT_FOUND_MSG,
- vendorSoftwareProductId, version == null ? null : version.toString()));
- }
+ private static final String PACKAGE_VERSION_NOT_FOUND_MSG = "Package for vendor software product with Id %s and version %s does not exist.";
+ private static final String PACKAGE_NOT_FOUND_MSG = "Package for vendor software product with Id %s does not exist.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Package not found error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ */
+ public PackageNotFoundErrorBuilder(String vendorSoftwareProductId, Version version) {
+ builder.withId(VendorSoftwareProductErrorCodes.PACKAGE_NOT_FOUND);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(PACKAGE_VERSION_NOT_FOUND_MSG, vendorSoftwareProductId, version == null ? null : version.toString()));
+ }
- /**
- * Instantiates a new Package not found error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- */
- public PackageNotFoundErrorBuilder(String vendorSoftwareProductId) {
- builder.withId(VendorSoftwareProductErrorCodes.PACKAGE_NOT_FOUND);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(PACKAGE_NOT_FOUND_MSG, vendorSoftwareProductId));
- }
+ /**
+ * Instantiates a new Package not found error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ */
+ public PackageNotFoundErrorBuilder(String vendorSoftwareProductId) {
+ builder.withId(VendorSoftwareProductErrorCodes.PACKAGE_NOT_FOUND);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(PACKAGE_NOT_FOUND_MSG, vendorSoftwareProductId));
+ }
- public ErrorCode build() {
- return builder.build();
- }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java
index fd8acd1497..73193abeb9 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,35 +17,33 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.TRANSLATION_FILE_CREATION;
+
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.dao.types.Version;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.TRANSLATION_FILE_CREATION;
-
public class TranslationFileCreationErrorBuilder {
- private static final String TRANSLATION_FILE_CREATION_ERROR_MSG =
- "Error while trying to create translation file from the package of vendor software product "
- + "with Id %s and version %s.";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new Translation file creation error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- */
- public TranslationFileCreationErrorBuilder(String vendorSoftwareProductId, Version version) {
- builder.withId(TRANSLATION_FILE_CREATION);
- builder.withCategory(ErrorCategory.SYSTEM);
- builder.withMessage(String
- .format(TRANSLATION_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId, version.toString()));
- }
+ private static final String TRANSLATION_FILE_CREATION_ERROR_MSG =
+ "Error while trying to create translation file from the package of vendor software product " + "with Id %s and version %s.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Translation file creation error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ */
+ public TranslationFileCreationErrorBuilder(String vendorSoftwareProductId, Version version) {
+ builder.withId(TRANSLATION_FILE_CREATION);
+ builder.withCategory(ErrorCategory.SYSTEM);
+ builder.withMessage(String.format(TRANSLATION_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId, version.toString()));
+ }
- public ErrorCode build() {
- return builder.build();
- }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java
index f808d542f1..5f2abbfbcc 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,60 +17,52 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
+import java.util.List;
+import java.util.Map;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.List;
-import java.util.Map;
-
public class UploadInvalidErrorBuilder extends BaseErrorBuilder {
- private static final String UPLOAD_INVALID_DETAILED_MSG =
- "File uploaded for vendor software product with Id %s and version %s is invalid: %s";
- private static final String UPLOAD_INVALID_MSG = "Uploaded file is invalid";
- /**
- * Instantiates a new Upload invalid error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- * @param errors the errors
- */
- public UploadInvalidErrorBuilder(String vendorSoftwareProductId, Version version,
- Map<String, List<ErrorMessage>> errors) {
- getErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.UPLOAD_INVALID);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(String
- .format(UPLOAD_INVALID_DETAILED_MSG, vendorSoftwareProductId, version.toString(),
- toString(errors)));
- }
+ private static final String UPLOAD_INVALID_DETAILED_MSG = "File uploaded for vendor software product with Id %s and version %s is invalid: %s";
+ private static final String UPLOAD_INVALID_MSG = "Uploaded file is invalid";
- /**
- * Instantiates a new Upload invalid error builder.
- */
- public UploadInvalidErrorBuilder() {
- getErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.UPLOAD_INVALID);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(UPLOAD_INVALID_MSG);
- }
+ /**
+ * Instantiates a new Upload invalid error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ * @param errors the errors
+ */
+ public UploadInvalidErrorBuilder(String vendorSoftwareProductId, Version version, Map<String, List<ErrorMessage>> errors) {
+ getErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.UPLOAD_INVALID);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(UPLOAD_INVALID_DETAILED_MSG, vendorSoftwareProductId, version.toString(), toString(errors)));
+ }
- private String toString(Map<String, List<ErrorMessage>> errors) {
- StringBuilder sb = new StringBuilder();
- errors.entrySet().stream()
- .forEach(entry -> singleErrorToString(sb, entry.getKey(), entry.getValue()));
- return sb.toString();
- }
+ /**
+ * Instantiates a new Upload invalid error builder.
+ */
+ public UploadInvalidErrorBuilder() {
+ getErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.UPLOAD_INVALID);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(UPLOAD_INVALID_MSG);
+ }
- private void singleErrorToString(StringBuilder sb, String fileName, List<ErrorMessage> errors) {
- sb.append(System.lineSeparator());
- sb.append(fileName);
- sb.append(sb.append(": "));
- errors.stream().forEach(
- error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("], "));
- }
+ private String toString(Map<String, List<ErrorMessage>> errors) {
+ StringBuilder sb = new StringBuilder();
+ errors.entrySet().stream().forEach(entry -> singleErrorToString(sb, entry.getKey(), entry.getValue()));
+ return sb.toString();
+ }
+ private void singleErrorToString(StringBuilder sb, String fileName, List<ErrorMessage> errors) {
+ sb.append(System.lineSeparator());
+ sb.append(fileName);
+ sb.append(sb.append(": "));
+ errors.stream().forEach(error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("], "));
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java
index c3a2862e39..1555bd77ee 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -21,69 +20,59 @@ import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.dao.types.Version;
public class VendorSoftwareProductInvalidErrorBuilder {
- private static final String VSP_INVALID_MSG =
- "Vendor software product with Id %s and version %s is invalid - does not contain "
- + "service model.";
- private static final String VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG = "VSP has to have a "
- + "minimum of one Deployment Flavor defined for being able to be instantiated.Please add a "
- + "Deployment Flavor and re-submit the VSP.";
- private static final String CANDIDATE_DATA_NOT_PROCESSED_OR_ABORTED = "Uploaded network package"
- + " file %s was not processed/aborted.";
- private static final String INVALID_PROCESSED_CANDIDATE = "Uploaded network package file %s"
- + " is invalid and need to be aborted";
- private VendorSoftwareProductInvalidErrorBuilder() {
+ private static final String VSP_INVALID_MSG =
+ "Vendor software product with Id %s and version %s is invalid - does not contain " + "service model.";
+ private static final String VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG =
+ "VSP has to have a " + "minimum of one Deployment Flavor defined for being able to be instantiated.Please add a "
+ + "Deployment Flavor and re-submit the VSP.";
+ private static final String CANDIDATE_DATA_NOT_PROCESSED_OR_ABORTED = "Uploaded network package" + " file %s was not processed/aborted.";
+ private static final String INVALID_PROCESSED_CANDIDATE = "Uploaded network package file %s" + " is invalid and need to be aborted";
- }
+ private VendorSoftwareProductInvalidErrorBuilder() {
+ }
- /**
- * Instantiates a new Vendor software product invalid error builder.
- *
- * @param vendorSoftwareProductId the vendor software product id
- * @param version the version
- */
- public static ErrorCode vendorSoftwareProductMissingServiceModelErrorBuilder(String
- vendorSoftwareProductId,
- Version version) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder
- .withMessage(String.format(VSP_INVALID_MSG, vendorSoftwareProductId, version.getId()));
- return builder.build();
- }
+ /**
+ * Instantiates a new Vendor software product invalid error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ * @param version the version
+ */
+ public static ErrorCode vendorSoftwareProductMissingServiceModelErrorBuilder(String vendorSoftwareProductId, Version version) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(VSP_INVALID_MSG, vendorSoftwareProductId, version.getId()));
+ return builder.build();
+ }
- /**
- * Instantiates a new Vendor software product invalid error builder.
- */
- public static ErrorCode vspMissingDeploymentFlavorErrorBuilder() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder
- .withMessage(VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG);
- return builder.build();
- }
+ /**
+ * Instantiates a new Vendor software product invalid error builder.
+ */
+ public static ErrorCode vspMissingDeploymentFlavorErrorBuilder() {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG);
+ return builder.build();
+ }
- public static ErrorCode candidateDataNotProcessedOrAbortedErrorBuilder(String fileName) {
- ErrorCode.ErrorCodeBuilder builder = getErrorCodeBuilder(VendorSoftwareProductErrorCodes
- .VSP_INVALID, ErrorCategory.APPLICATION);
- builder.withMessage(String.format(CANDIDATE_DATA_NOT_PROCESSED_OR_ABORTED, fileName));
- return builder.build();
- }
+ public static ErrorCode candidateDataNotProcessedOrAbortedErrorBuilder(String fileName) {
+ ErrorCode.ErrorCodeBuilder builder = getErrorCodeBuilder(VendorSoftwareProductErrorCodes.VSP_INVALID, ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(CANDIDATE_DATA_NOT_PROCESSED_OR_ABORTED, fileName));
+ return builder.build();
+ }
- public static ErrorCode invalidProcessedCandidate(String fileName) {
- ErrorCode.ErrorCodeBuilder builder = getErrorCodeBuilder(VendorSoftwareProductErrorCodes
- .VSP_INVALID, ErrorCategory.APPLICATION);
- builder.withMessage(String.format(INVALID_PROCESSED_CANDIDATE, fileName));
- return builder.build();
- }
+ public static ErrorCode invalidProcessedCandidate(String fileName) {
+ ErrorCode.ErrorCodeBuilder builder = getErrorCodeBuilder(VendorSoftwareProductErrorCodes.VSP_INVALID, ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(INVALID_PROCESSED_CANDIDATE, fileName));
+ return builder.build();
+ }
- public static ErrorCode.ErrorCodeBuilder getErrorCodeBuilder(String errorCode, ErrorCategory
- errorCategory) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(errorCode);
- builder.withCategory(errorCategory);
- return builder;
- }
+ public static ErrorCode.ErrorCodeBuilder getErrorCodeBuilder(String errorCode, ErrorCategory errorCategory) {
+ ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+ builder.withId(errorCode);
+ builder.withCategory(errorCategory);
+ return builder;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/exception/OnboardPackageException.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/exception/OnboardPackageException.java
index 2e88357e0b..4f487f8b50 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/exception/OnboardPackageException.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/exception/OnboardPackageException.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.exception;
public class OnboardPackageException extends Exception {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerFactoryImpl.java
index 8d8dce878e..bd7ee1ee97 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
@@ -25,18 +24,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFa
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
-public class ComponentDependencyModelManagerFactoryImpl extends
- ComponentDependencyModelManagerFactory {
-
- private static final ComponentDependencyModelManager INSTANCE =
- new ComponentDependencyModelManagerImpl(
- ComponentManagerFactory.getInstance().createInterface(),
- ComponentDependencyModelDaoFactory.getInstance().createInterface()
- );
+public class ComponentDependencyModelManagerFactoryImpl extends ComponentDependencyModelManagerFactory {
- @Override
- public ComponentDependencyModelManager createInterface() {
- return INSTANCE;
- }
+ private static final ComponentDependencyModelManager INSTANCE = new ComponentDependencyModelManagerImpl(
+ ComponentManagerFactory.getInstance().createInterface(), ComponentDependencyModelDaoFactory.getInstance().createInterface());
+ @Override
+ public ComponentDependencyModelManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java
index 596ce5010f..71b3e4b672 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import java.util.Collection;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
@@ -29,84 +29,68 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelEr
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public class ComponentDependencyModelManagerImpl implements ComponentDependencyModelManager {
- private ComponentManager componentManager;
- private ComponentDependencyModelDao componentDependencyModelDao;
-
- public ComponentDependencyModelManagerImpl(
- ComponentManager componentManager, ComponentDependencyModelDao componentDependencyModelDao) {
- this.componentManager = componentManager;
- this.componentDependencyModelDao = componentDependencyModelDao;
- }
-
- @Override
- public Collection<ComponentDependencyModelEntity> list(String vspId, Version version) {
- return componentDependencyModelDao
- .list(new ComponentDependencyModelEntity(vspId, version, null));
- }
+ private ComponentManager componentManager;
+ private ComponentDependencyModelDao componentDependencyModelDao;
- @Override
- public ComponentDependencyModelEntity createComponentDependency(ComponentDependencyModelEntity
- entity, String vspId,
- Version version) {
+ public ComponentDependencyModelManagerImpl(ComponentManager componentManager, ComponentDependencyModelDao componentDependencyModelDao) {
+ this.componentManager = componentManager;
+ this.componentDependencyModelDao = componentDependencyModelDao;
+ }
- validateComponentDependency(entity);
- entity.setId(CommonMethods.nextUuId());
- componentDependencyModelDao.create(entity);
- return entity;
- }
+ @Override
+ public Collection<ComponentDependencyModelEntity> list(String vspId, Version version) {
+ return componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null));
+ }
- private void validateComponentDependency(ComponentDependencyModelEntity entity) {
- if (!StringUtils.isEmpty(entity.getSourceComponentId())) {
- componentManager.validateComponentExistence(entity.getVspId(), entity.getVersion(),
- entity.getSourceComponentId());
- if (entity.getSourceComponentId().equals(entity.getTargetComponentId())) {
- ErrorCode errorCode =
- ComponentDependencyModelErrorBuilder.getSourceTargetComponentEqualErrorBuilder();
- throw new CoreException(errorCode);
- }
- } else {
- ErrorCode errorCode = ComponentDependencyModelErrorBuilder
- .getNoSourceComponentErrorBuilder();
- throw new CoreException(errorCode);
+ @Override
+ public ComponentDependencyModelEntity createComponentDependency(ComponentDependencyModelEntity entity, String vspId, Version version) {
+ validateComponentDependency(entity);
+ entity.setId(CommonMethods.nextUuId());
+ componentDependencyModelDao.create(entity);
+ return entity;
}
- if (!StringUtils.isEmpty(entity.getTargetComponentId())) {
- componentManager.validateComponentExistence(entity.getVspId(), entity.getVersion(),
- entity.getTargetComponentId());
+ private void validateComponentDependency(ComponentDependencyModelEntity entity) {
+ if (!StringUtils.isEmpty(entity.getSourceComponentId())) {
+ componentManager.validateComponentExistence(entity.getVspId(), entity.getVersion(), entity.getSourceComponentId());
+ if (entity.getSourceComponentId().equals(entity.getTargetComponentId())) {
+ ErrorCode errorCode = ComponentDependencyModelErrorBuilder.getSourceTargetComponentEqualErrorBuilder();
+ throw new CoreException(errorCode);
+ }
+ } else {
+ ErrorCode errorCode = ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder();
+ throw new CoreException(errorCode);
+ }
+ if (!StringUtils.isEmpty(entity.getTargetComponentId())) {
+ componentManager.validateComponentExistence(entity.getVspId(), entity.getVersion(), entity.getTargetComponentId());
+ }
}
- }
- @Override
- public void delete(String vspId, Version version, String dependencyId) {
- ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(vspId,
- version, dependencyId);
- if (componentDependencyEntity != null) {
- componentDependencyModelDao.delete(componentDependencyEntity);
+ @Override
+ public void delete(String vspId, Version version, String dependencyId) {
+ ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(vspId, version, dependencyId);
+ if (componentDependencyEntity != null) {
+ componentDependencyModelDao.delete(componentDependencyEntity);
+ }
}
- }
- @Override
- public void update(ComponentDependencyModelEntity entity) {
- getComponentDependency(entity.getVspId(), entity.getVersion(), entity.getId());
- validateComponentDependency(entity);
- componentDependencyModelDao.update(entity);
- }
+ @Override
+ public void update(ComponentDependencyModelEntity entity) {
+ getComponentDependency(entity.getVspId(), entity.getVersion(), entity.getId());
+ validateComponentDependency(entity);
+ componentDependencyModelDao.update(entity);
+ }
- @Override
- public ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId) {
- return getComponentDependency(vspId, version, dependencyId);
- }
+ @Override
+ public ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId) {
+ return getComponentDependency(vspId, version, dependencyId);
+ }
- private ComponentDependencyModelEntity getComponentDependency(String vspId, Version version,
- String dependencyId) {
- ComponentDependencyModelEntity retrieved = componentDependencyModelDao.get(
- new ComponentDependencyModelEntity(vspId, version, dependencyId));
- VersioningUtil.validateEntityExistence(retrieved, new ComponentDependencyModelEntity(
- vspId, version, dependencyId), VspDetails.ENTITY_TYPE);
- return retrieved;
- }
+ private ComponentDependencyModelEntity getComponentDependency(String vspId, Version version, String dependencyId) {
+ ComponentDependencyModelEntity retrieved = componentDependencyModelDao.get(new ComponentDependencyModelEntity(vspId, version, dependencyId));
+ VersioningUtil.validateEntityExistence(retrieved, new ComponentDependencyModelEntity(vspId, version, dependencyId), VspDetails.ENTITY_TYPE);
+ return retrieved;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java
index 133ebdb50d..526aea13a4 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
@@ -28,16 +27,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
public class ComponentManagerFactoryImpl extends ComponentManagerFactory {
- private static final ComponentManager INSTANCE =
- new ComponentManagerImpl(
- ComponentDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
- NicManagerFactory.getInstance().createInterface(),
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface()
- );
- @Override
- public ComponentManager createInterface() {
- return INSTANCE;
- }
+ private static final ComponentManager INSTANCE = new ComponentManagerImpl(ComponentDaoFactory.getInstance().createInterface(),
+ CompositionEntityDataManagerFactory.getInstance().createInterface(), NicManagerFactory.getInstance().createInterface(),
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
+
+ @Override
+ public ComponentManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
index ca8757dd11..a4527f5030 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
@@ -13,9 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.COMPUTE_TYPE_PREFIX;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.common.errors.CoreException;
@@ -42,220 +47,174 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.COMPUTE_TYPE_PREFIX;
-
public class ComponentManagerImpl implements ComponentManager {
- private final ComponentDao componentDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- private final NicManager nicManager;
- private final VendorSoftwareProductInfoDao vspInfoDao;
-
- public ComponentManagerImpl(ComponentDao componentDao,
- CompositionEntityDataManager compositionEntityDataManager,
- NicManager nicManager,
- VendorSoftwareProductInfoDao vspInfoDao) {
- this.componentDao = componentDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.nicManager = nicManager;
- this.vspInfoDao = vspInfoDao;
- }
- @Override
- public Collection<ComponentEntity> listComponents(String vspId, Version version) {
- return componentDao.list(new ComponentEntity(vspId, version, null));
- }
-
- @Override
- public void deleteComponents(String vspId, Version version) {
- if (!vspInfoDao.isManual(vspId, version)) {
- throw new CoreException(
- new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+ private final ComponentDao componentDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
+ private final NicManager nicManager;
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+
+ public ComponentManagerImpl(ComponentDao componentDao, CompositionEntityDataManager compositionEntityDataManager, NicManager nicManager,
+ VendorSoftwareProductInfoDao vspInfoDao) {
+ this.componentDao = componentDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
+ this.nicManager = nicManager;
+ this.vspInfoDao = vspInfoDao;
}
- }
-
- @Override
- public ComponentEntity createComponent(ComponentEntity component) {
- final String vfcAddNotAllowedInHeatOnboardingMsg =
- "VFCs cannot be added for VSPs onboarded with HEAT.";
- ComponentEntity createdComponent;
- if (!vspInfoDao.isManual(component.getVspId(), component.getVersion())) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder()
- .withId(VendorSoftwareProductErrorCodes.VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING)
- .withMessage(vfcAddNotAllowedInHeatOnboardingMsg).build());
- } else {
- validateComponentManual(component);
- updateComponentName(component);
- createdComponent = compositionEntityDataManager.createComponent(component, true);
+ @Override
+ public Collection<ComponentEntity> listComponents(String vspId, Version version) {
+ return componentDao.list(new ComponentEntity(vspId, version, null));
}
- return createdComponent;
- }
- private void updateComponentName(ComponentEntity component) {
- ComponentData data = component.getComponentCompositionData();
- data.setName(COMPUTE_TYPE_PREFIX + data.getDisplayName());
- component.setComponentCompositionData(data);
- }
-
- private void validateComponentManual(ComponentEntity component) {
- final String vspVfcCountExceedMsg = "Creation of only one VFC per "
- + "VSP allowed.";
-
- final String vspVfcDuplicateNameMsg = "VFC with specified name "
- + "already present in given VSP.";
-
- Collection<ComponentEntity> vspComponentList =
- listComponents(component.getVspId(), component.getVersion());
- if (!vspComponentList.isEmpty()) {
- //1707 release only supports 1 VFC in VSP (manual creation)
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder()
- .withId(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED)
- .withMessage(vspVfcCountExceedMsg).build());
+ @Override
+ public void deleteComponents(String vspId, Version version) {
+ if (!vspInfoDao.isManual(vspId, version)) {
+ throw new CoreException(new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+ }
}
- if (!isVfcNameUnique(vspComponentList,
- component.getComponentCompositionData().getDisplayName())) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder()
- .withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
- .withMessage(vspVfcDuplicateNameMsg).build());
- }
- }
- private boolean isVfcNameUnique(Collection<ComponentEntity> component, String displayName) {
- for (ComponentEntity comp : component) {
- if (comp.getComponentCompositionData().getDisplayName().equalsIgnoreCase(displayName)) {
- return false;
- }
+ @Override
+ public ComponentEntity createComponent(ComponentEntity component) {
+ final String vfcAddNotAllowedInHeatOnboardingMsg = "VFCs cannot be added for VSPs onboarded with HEAT.";
+ ComponentEntity createdComponent;
+ if (!vspInfoDao.isManual(component.getVspId(), component.getVersion())) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING)
+ .withMessage(vfcAddNotAllowedInHeatOnboardingMsg).build());
+ } else {
+ validateComponentManual(component);
+ updateComponentName(component);
+ createdComponent = compositionEntityDataManager.createComponent(component, true);
+ }
+ return createdComponent;
}
- return true;
- }
-
- @Override
- public CompositionEntityValidationData updateComponent(ComponentEntity component) {
- ComponentEntity retrieved =
- getValidatedComponent(component.getVspId(), component.getVersion(), component.getId());
- boolean isManual = vspInfoDao.isManual(component.getVspId(), component.getVersion());
- if (isManual) {
- validateComponentUpdateManual(retrieved);
+ private void updateComponentName(ComponentEntity component) {
+ ComponentData data = component.getComponentCompositionData();
+ data.setName(COMPUTE_TYPE_PREFIX + data.getDisplayName());
+ component.setComponentCompositionData(data);
}
- ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
- schemaInput.setManual(isManual);
- schemaInput.setComponent(retrieved.getComponentCompositionData());
-
- CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(component, SchemaTemplateContext.composition, schemaInput);
- if (CollectionUtils.isEmpty(validationData.getErrors())) {
- if (isManual) {
- updateComponentName(component);
- }
- componentDao.update(component);
+ private void validateComponentManual(ComponentEntity component) {
+ final String vspVfcCountExceedMsg = "Creation of only one VFC per " + "VSP allowed.";
+ final String vspVfcDuplicateNameMsg = "VFC with specified name " + "already present in given VSP.";
+ Collection<ComponentEntity> vspComponentList = listComponents(component.getVspId(), component.getVersion());
+ if (!vspComponentList.isEmpty()) {
+ //1707 release only supports 1 VFC in VSP (manual creation)
+ throw new CoreException(
+ new ErrorCode.ErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED).withMessage(vspVfcCountExceedMsg)
+ .build());
+ }
+ if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData().getDisplayName())) {
+ throw new CoreException(
+ new ErrorCode.ErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME).withMessage(vspVfcDuplicateNameMsg)
+ .build());
+ }
}
- return validationData;
- }
- private void validateComponentUpdateManual(ComponentEntity component) {
- Collection<ComponentEntity> vspComponentList =
- listComponents(component.getVspId(), component.getVersion());
- //VFC name should be unique within VSP
- //Removing VFC with same ID from list to avoid self compare
- for (ComponentEntity ce : vspComponentList) {
- if (ce.getId().equals(component.getId())) {
- vspComponentList.remove(ce);
- break;
- }
+ private boolean isVfcNameUnique(Collection<ComponentEntity> component, String displayName) {
+ for (ComponentEntity comp : component) {
+ if (comp.getComponentCompositionData().getDisplayName().equalsIgnoreCase(displayName)) {
+ return false;
+ }
+ }
+ return true;
}
- if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData()
- .getDisplayName())) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder()
- .withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
- .withMessage("VFC with specified name already present in given VSP.").build());
+ @Override
+ public CompositionEntityValidationData updateComponent(ComponentEntity component) {
+ ComponentEntity retrieved = getValidatedComponent(component.getVspId(), component.getVersion(), component.getId());
+ boolean isManual = vspInfoDao.isManual(component.getVspId(), component.getVersion());
+ if (isManual) {
+ validateComponentUpdateManual(retrieved);
+ }
+ ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
+ schemaInput.setManual(isManual);
+ schemaInput.setComponent(retrieved.getComponentCompositionData());
+ CompositionEntityValidationData validationData = compositionEntityDataManager
+ .validateEntity(component, SchemaTemplateContext.composition, schemaInput);
+ if (CollectionUtils.isEmpty(validationData.getErrors())) {
+ if (isManual) {
+ updateComponentName(component);
+ }
+ componentDao.update(component);
+ }
+ return validationData;
}
- }
-
- @Override
- public CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version,
- String componentId) {
- ComponentEntity componentEntity = getValidatedComponent(vspId, version, componentId);
- ComponentData component = componentEntity.getComponentCompositionData();
-
- ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(vspId, version));
- schemaInput.setComponent(component);
-
- CompositionEntityResponse<ComponentData> response = new CompositionEntityResponse<>();
- response.setId(componentId);
- response.setData(component);
- response.setSchema(getComponentCompositionSchema(schemaInput));
- return response;
- }
- @Override
- public void deleteComponent(String vspId, Version version, String componentId) {
- if (!vspInfoDao.isManual(vspId, version)) {
- throw new CoreException(
- new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+ private void validateComponentUpdateManual(ComponentEntity component) {
+ Collection<ComponentEntity> vspComponentList = listComponents(component.getVspId(), component.getVersion());
+ //VFC name should be unique within VSP
+
+ //Removing VFC with same ID from list to avoid self compare
+ for (ComponentEntity ce : vspComponentList) {
+ if (ce.getId().equals(component.getId())) {
+ vspComponentList.remove(ce);
+ break;
+ }
+ }
+ if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData().getDisplayName())) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME)
+ .withMessage("VFC with specified name already present in given VSP.").build());
+ }
}
- }
- @Override
- public QuestionnaireResponse getQuestionnaire(String vspId, Version version,
- String componentId) {
- QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
- ComponentEntity component = componentDao.getQuestionnaireData(vspId, version, componentId);
- VersioningUtil
- .validateEntityExistence(component, new ComponentEntity(vspId, version, componentId),
- VspDetails.ENTITY_TYPE);
+ @Override
+ public CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version, String componentId) {
+ ComponentEntity componentEntity = getValidatedComponent(vspId, version, componentId);
+ ComponentData component = componentEntity.getComponentCompositionData();
+ ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+ schemaInput.setComponent(component);
+ CompositionEntityResponse<ComponentData> response = new CompositionEntityResponse<>();
+ response.setId(componentId);
+ response.setData(component);
+ response.setSchema(getComponentCompositionSchema(schemaInput));
+ return response;
+ }
- questionnaireResponse.setData(component.getQuestionnaireData());
- List<String> nicNames = nicManager.listNics(vspId, version, componentId).stream()
- .map(nic -> nic.getNicCompositionData().getName()).collect(Collectors.toList());
- questionnaireResponse.setSchema(getComponentQuestionnaireSchema(
- new ComponentQuestionnaireSchemaInput(nicNames, questionnaireResponse.getData() == null
- ? null : JsonUtil.json2Object(questionnaireResponse.getData(), Map.class),
- null, false)));
- return questionnaireResponse;
- }
+ @Override
+ public void deleteComponent(String vspId, Version version, String componentId) {
+ if (!vspInfoDao.isManual(vspId, version)) {
+ throw new CoreException(new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+ }
+ }
- @Override
- public void updateQuestionnaire(String vspId, Version version, String componentId,
- String questionnaireData) {
- validateComponentExistence(vspId, version, componentId);
+ @Override
+ public QuestionnaireResponse getQuestionnaire(String vspId, Version version, String componentId) {
+ QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
+ ComponentEntity component = componentDao.getQuestionnaireData(vspId, version, componentId);
+ VersioningUtil.validateEntityExistence(component, new ComponentEntity(vspId, version, componentId), VspDetails.ENTITY_TYPE);
+ questionnaireResponse.setData(component.getQuestionnaireData());
+ List<String> nicNames = nicManager.listNics(vspId, version, componentId).stream().map(nic -> nic.getNicCompositionData().getName())
+ .collect(Collectors.toList());
+ questionnaireResponse.setSchema(getComponentQuestionnaireSchema(new ComponentQuestionnaireSchemaInput(nicNames,
+ questionnaireResponse.getData() == null ? null : JsonUtil.json2Object(questionnaireResponse.getData(), Map.class), null, false)));
+ return questionnaireResponse;
+ }
- componentDao.updateQuestionnaireData(vspId, version, componentId, questionnaireData);
- }
+ @Override
+ public void updateQuestionnaire(String vspId, Version version, String componentId, String questionnaireData) {
+ validateComponentExistence(vspId, version, componentId);
+ componentDao.updateQuestionnaireData(vspId, version, componentId, questionnaireData);
+ }
- @Override
- public void validateComponentExistence(String vspId, Version version, String componentId) {
- getValidatedComponent(vspId, version, componentId);
- }
+ @Override
+ public void validateComponentExistence(String vspId, Version version, String componentId) {
+ getValidatedComponent(vspId, version, componentId);
+ }
- private ComponentEntity getValidatedComponent(String vspId, Version version, String componentId) {
- ComponentEntity retrieved = componentDao.get(new ComponentEntity(vspId, version, componentId));
- VersioningUtil
- .validateEntityExistence(retrieved, new ComponentEntity(vspId, version, componentId),
- VspDetails.ENTITY_TYPE);
- return retrieved;
- }
+ private ComponentEntity getValidatedComponent(String vspId, Version version, String componentId) {
+ ComponentEntity retrieved = componentDao.get(new ComponentEntity(vspId, version, componentId));
+ VersioningUtil.validateEntityExistence(retrieved, new ComponentEntity(vspId, version, componentId), VspDetails.ENTITY_TYPE);
+ return retrieved;
+ }
- protected String getComponentCompositionSchema(ComponentCompositionSchemaInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.component, schemaInput);
- }
+ protected String getComponentCompositionSchema(ComponentCompositionSchemaInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.component, schemaInput);
+ }
- protected String getComponentQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component,
- schemaInput);
- }
+ protected String getComponentQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, schemaInput);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerFactoryImpl.java
index 209fecc0da..ffe774ebfb 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,25 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.*;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
public class CompositionEntityDataManagerFactoryImpl extends CompositionEntityDataManagerFactory {
- @Override
- public CompositionEntityDataManager createInterface() {
- // this class is stateful! it must be recreated from scratch on every use!!!
- return new CompositionEntityDataManagerImpl(
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- ComponentDaoFactory.getInstance().createInterface(),
- NicDaoFactory.getInstance().createInterface(),
- NetworkDaoFactory.getInstance().createInterface(),
- ImageDaoFactory.getInstance().createInterface(),
- ComputeDaoFactory.getInstance().createInterface(),
- DeploymentFlavorDaoFactory.getInstance().createInterface());
- }
+ @Override
+ public CompositionEntityDataManager createInterface() {
+ // this class is stateful! it must be recreated from scratch on every use!!!
+ return new CompositionEntityDataManagerImpl(VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
+ ComponentDaoFactory.getInstance().createInterface(), NicDaoFactory.getInstance().createInterface(),
+ NetworkDaoFactory.getInstance().createInterface(), ImageDaoFactory.getInstance().createInterface(),
+ ComputeDaoFactory.getInstance().createInterface(), DeploymentFlavorDaoFactory.getInstance().createInterface());
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
index e9c75319f5..d239615cab 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import java.util.ArrayList;
@@ -72,535 +71,434 @@ import org.openecomp.sdc.versioning.dao.types.Version;
public class CompositionEntityDataManagerImpl implements CompositionEntityDataManager {
- private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR =
- "COMPOSITION_ENTITY_DATA_MANAGER_ERR";
- private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG =
- "Invalid input: %s may not be null";
- private static final String MISSING_OR_INVALID_QUESTIONNAIRE_MSG =
- "Data is missing/invalid for this %s. Please refill and resubmit.";
-
- private static final Logger logger =
- LoggerFactory.getLogger(CompositionEntityDataManagerImpl.class);
- private Map<CompositionEntityId, CompositionEntityData> entities = new HashMap<>();
- private Map<CompositionEntityType, String> nonDynamicSchemas =
- new EnumMap<>(CompositionEntityType.class);
- private List<CompositionEntityValidationData> roots = new ArrayList<>();
-
- private VendorSoftwareProductInfoDao vspInfoDao;
- private ComponentDao componentDao;
- private NicDao nicDao;
- private NetworkDao networkDao;
- private ImageDao imageDao;
- private ComputeDao computeDao;
- private DeploymentFlavorDao deploymentFlavorDao;
-
- public CompositionEntityDataManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
- ComponentDao componentDao,
- NicDao nicDao, NetworkDao networkDao,
- ImageDao imageDao, ComputeDao computeDao,
- DeploymentFlavorDao deploymentFlavorDao) {
- this.vspInfoDao = vspInfoDao;
- this.componentDao = componentDao;
- this.nicDao = nicDao;
- this.networkDao = networkDao;
- this.imageDao = imageDao;
- this.computeDao = computeDao;
- this.deploymentFlavorDao = deploymentFlavorDao;
- }
-
- /**
- * Validate entity composition entity validation data.
- *
- * @param entity the entity
- * @param schemaTemplateContext the schema template context
- * @param schemaTemplateInput the schema template input
- * @return the composition entity validation data
- */
- @Override
- public CompositionEntityValidationData validateEntity(CompositionEntity entity,
- SchemaTemplateContext schemaTemplateContext,
- SchemaTemplateInput schemaTemplateInput) {
- if (entity == null) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
- .withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR).withMessage(
- String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "composition entity"))
- .build());
- }
- if (schemaTemplateContext == null) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
- .withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR).withMessage(
- String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "schema template context"))
- .build());
- }
-
- CompositionEntityValidationData validationData =
- new CompositionEntityValidationData(entity.getType(), entity.getId());
- String json =
- schemaTemplateContext == SchemaTemplateContext.composition ? entity.getCompositionData()
- : entity.getQuestionnaireData();
- validationData.setErrors(JsonUtil.validate(
- json == null ? JsonUtil.object2Json(new Object()) : json,
- generateSchema(schemaTemplateContext, entity.getType(), schemaTemplateInput)));
- return validationData;
- }
-
- /**
- * Add entity.
- *
- * @param entity the entity
- * @param schemaTemplateInput the schema template input
- */
- @Override
- public void addEntity(CompositionEntity entity, SchemaTemplateInput schemaTemplateInput) {
- if (entity == null) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
- .withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR).withMessage(
- String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "composition entity"))
- .build());
- }
- entities.put(entity.getCompositionEntityId(),
- new CompositionEntityData(entity, schemaTemplateInput));
- }
-
- /**
- * Validate entities questionnaire map.
- *
- * @return the map
- */
- @Override
- public Map<CompositionEntityId, Collection<String>> validateEntitiesQuestionnaire() {
- Map<CompositionEntityId, Collection<String>> errorsByEntityId = new HashMap<>();
- entities.forEach((key, value) -> {
- Collection<String> errors = validateQuestionnaire(value);
- if (errors != null) {
- errorsByEntityId.put(key, errors);
- }
- });
- return errorsByEntityId;
- }
-
- /**
- * Build trees.
- */
- @Override
- public void buildTrees() {
- Map<CompositionEntityId, CompositionEntityValidationData> entitiesValidationData =
- new HashMap<>();
- entities.forEach((key, value) -> addValidationDataEntity(entitiesValidationData, key,
- value.entity));
- }
-
- public Collection<CompositionEntityValidationData> getTrees() {
- return roots;
- }
-
- @Override
- public void saveCompositionData(String vspId, Version version, CompositionData compositionData) {
- if (Objects.isNull(compositionData)) {
- return;
- }
-
- Map<String, String> networkIdByName = saveNetworks(vspId, version, compositionData);
- saveComponents(vspId, version, compositionData, networkIdByName);
- }
-
- @Override
- public Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId) {
- Set<CompositionEntityValidationData> entitiesWithErrors = new HashSet<>();
- for (CompositionEntityValidationData root : roots) {
- if (root.getEntityId().equals(vspId)) {
- getEntityListWithErrors(root, entitiesWithErrors);
- break;
- }
- }
-
- if (CollectionUtils.isNotEmpty(entitiesWithErrors)) {
- updateValidationCompositionEntityName(entitiesWithErrors);
- return entitiesWithErrors;
- }
-
- return new HashSet<>();
- }
-
- private void saveComponents(String vspId, Version version, CompositionData compositionData,
- Map<String, String> networkIdByName) {
- if (CollectionUtils.isNotEmpty(compositionData.getComponents())) {
- for (Component component : compositionData.getComponents()) {
- ComponentEntity componentEntity = new ComponentEntity(vspId, version, null);
- componentEntity.setComponentCompositionData(component.getData());
-
- String componentId = createComponent(componentEntity, false).getId();
-
- saveImagesByComponent(vspId, version, component, componentId);
- saveComputesFlavorByComponent(vspId, version, component, componentId);
-
- saveNicsByComponent(vspId, version, networkIdByName, component, componentId);
- }
- }
- }
-
- private void saveNicsByComponent(String vspId, Version version,
- Map<String, String> networkIdByName, Component component,
- String componentId) {
- if (CollectionUtils.isNotEmpty(component.getNics())) {
- for (Nic nic : component.getNics()) {
- if (nic.getNetworkName() != null && MapUtils.isNotEmpty(networkIdByName)) {
- nic.setNetworkId(networkIdByName.get(nic.getNetworkName()));
+ private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR = "COMPOSITION_ENTITY_DATA_MANAGER_ERR";
+ private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG = "Invalid input: %s may not be null";
+ private static final String MISSING_OR_INVALID_QUESTIONNAIRE_MSG = "Data is missing/invalid for this %s. Please refill and resubmit.";
+ private static final Logger logger = LoggerFactory.getLogger(CompositionEntityDataManagerImpl.class);
+ private Map<CompositionEntityId, CompositionEntityData> entities = new HashMap<>();
+ private Map<CompositionEntityType, String> nonDynamicSchemas = new EnumMap<>(CompositionEntityType.class);
+ private List<CompositionEntityValidationData> roots = new ArrayList<>();
+ private VendorSoftwareProductInfoDao vspInfoDao;
+ private ComponentDao componentDao;
+ private NicDao nicDao;
+ private NetworkDao networkDao;
+ private ImageDao imageDao;
+ private ComputeDao computeDao;
+ private DeploymentFlavorDao deploymentFlavorDao;
+
+ public CompositionEntityDataManagerImpl(VendorSoftwareProductInfoDao vspInfoDao, ComponentDao componentDao, NicDao nicDao, NetworkDao networkDao,
+ ImageDao imageDao, ComputeDao computeDao, DeploymentFlavorDao deploymentFlavorDao) {
+ this.vspInfoDao = vspInfoDao;
+ this.componentDao = componentDao;
+ this.nicDao = nicDao;
+ this.networkDao = networkDao;
+ this.imageDao = imageDao;
+ this.computeDao = computeDao;
+ this.deploymentFlavorDao = deploymentFlavorDao;
+ }
+
+ /**
+ * Validate entity composition entity validation data.
+ *
+ * @param entity the entity
+ * @param schemaTemplateContext the schema template context
+ * @param schemaTemplateInput the schema template input
+ * @return the composition entity validation data
+ */
+ @Override
+ public CompositionEntityValidationData validateEntity(CompositionEntity entity, SchemaTemplateContext schemaTemplateContext,
+ SchemaTemplateInput schemaTemplateInput) {
+ if (entity == null) {
+ throw new CoreException(
+ new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR)
+ .withMessage(String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "composition entity")).build());
+ }
+ if (schemaTemplateContext == null) {
+ throw new CoreException(
+ new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR)
+ .withMessage(String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "schema template context")).build());
}
- nic.setNetworkName(null);
- //For heat flow set network type to be internal by default for NIC
- nic.setNetworkType(NetworkType.Internal);
+ CompositionEntityValidationData validationData = new CompositionEntityValidationData(entity.getType(), entity.getId());
+ String json = schemaTemplateContext == SchemaTemplateContext.composition ? entity.getCompositionData() : entity.getQuestionnaireData();
+ validationData.setErrors(JsonUtil.validate(json == null ? JsonUtil.object2Json(new Object()) : json,
+ generateSchema(schemaTemplateContext, entity.getType(), schemaTemplateInput)));
+ return validationData;
+ }
- NicEntity nicEntity = new NicEntity(vspId, version, componentId, null);
- nicEntity.setNicCompositionData(nic);
- createNic(nicEntity);
- }
+ /**
+ * Add entity.
+ *
+ * @param entity the entity
+ * @param schemaTemplateInput the schema template input
+ */
+ @Override
+ public void addEntity(CompositionEntity entity, SchemaTemplateInput schemaTemplateInput) {
+ if (entity == null) {
+ throw new CoreException(
+ new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR)
+ .withMessage(String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "composition entity")).build());
+ }
+ entities.put(entity.getCompositionEntityId(), new CompositionEntityData(entity, schemaTemplateInput));
}
- }
- private Map<String, String> saveNetworks(String vspId, Version version,
- CompositionData compositionData) {
- Map<String, String> networkIdByName = new HashMap<>();
- if (CollectionUtils.isNotEmpty(compositionData.getNetworks())) {
- for (Network network : compositionData.getNetworks()) {
+ /**
+ * Validate entities questionnaire map.
+ *
+ * @return the map
+ */
+ @Override
+ public Map<CompositionEntityId, Collection<String>> validateEntitiesQuestionnaire() {
+ Map<CompositionEntityId, Collection<String>> errorsByEntityId = new HashMap<>();
+ entities.forEach((key, value) -> {
+ Collection<String> errors = validateQuestionnaire(value);
+ if (errors != null) {
+ errorsByEntityId.put(key, errors);
+ }
+ });
+ return errorsByEntityId;
+ }
- NetworkEntity networkEntity = new NetworkEntity(vspId, version, null);
- networkEntity.setNetworkCompositionData(network);
+ /**
+ * Build trees.
+ */
+ @Override
+ public void buildTrees() {
+ Map<CompositionEntityId, CompositionEntityValidationData> entitiesValidationData = new HashMap<>();
+ entities.forEach((key, value) -> addValidationDataEntity(entitiesValidationData, key, value.entity));
+ }
- if (network.getName() != null) {
- networkIdByName.put(network.getName(), createNetwork(networkEntity).getId());
- }
- }
+ public Collection<CompositionEntityValidationData> getTrees() {
+ return roots;
}
- return networkIdByName;
- }
- private NetworkEntity createNetwork(NetworkEntity network) {
- //network.setId(CommonMethods.nextUuId()); will be set by the dao
- networkDao.create(network);
- return network;
- }
+ @Override
+ public void saveCompositionData(String vspId, Version version, CompositionData compositionData) {
+ if (Objects.isNull(compositionData)) {
+ return;
+ }
+ Map<String, String> networkIdByName = saveNetworks(vspId, version, compositionData);
+ saveComponents(vspId, version, compositionData, networkIdByName);
+ }
- @Override
- public ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp) {
- //component.setId(CommonMethods.nextUuId()); will be set by the dao
- ComponentQuestionnaireSchemaInput schemaInput = new ComponentQuestionnaireSchemaInput(null,
- null, component.getComponentCompositionData().getDisplayName(), isManualVsp);
- String questionnarieData = new JsonSchemaDataGenerator(generateSchema(SchemaTemplateContext.questionnaire,
- CompositionEntityType.component, schemaInput)).generateData();
- component.setQuestionnaireData(questionnarieData);
+ @Override
+ public Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId) {
+ Set<CompositionEntityValidationData> entitiesWithErrors = new HashSet<>();
+ for (CompositionEntityValidationData root : roots) {
+ if (root.getEntityId().equals(vspId)) {
+ getEntityListWithErrors(root, entitiesWithErrors);
+ break;
+ }
+ }
+ if (CollectionUtils.isNotEmpty(entitiesWithErrors)) {
+ updateValidationCompositionEntityName(entitiesWithErrors);
+ return entitiesWithErrors;
+ }
+ return new HashSet<>();
+ }
- componentDao.create(component);
- return component;
- }
+ private void saveComponents(String vspId, Version version, CompositionData compositionData, Map<String, String> networkIdByName) {
+ if (CollectionUtils.isNotEmpty(compositionData.getComponents())) {
+ for (Component component : compositionData.getComponents()) {
+ ComponentEntity componentEntity = new ComponentEntity(vspId, version, null);
+ componentEntity.setComponentCompositionData(component.getData());
+ String componentId = createComponent(componentEntity, false).getId();
+ saveImagesByComponent(vspId, version, component, componentId);
+ saveComputesFlavorByComponent(vspId, version, component, componentId);
+ saveNicsByComponent(vspId, version, networkIdByName, component, componentId);
+ }
+ }
+ }
- @Override
- public NicEntity createNic(NicEntity nic) {
- //nic.setId(CommonMethods.nextUuId()); will be set by the dao
- nic.setQuestionnaireData(
- new JsonSchemaDataGenerator(
- generateSchema(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, null))
- .generateData());
+ private void saveNicsByComponent(String vspId, Version version, Map<String, String> networkIdByName, Component component, String componentId) {
+ if (CollectionUtils.isNotEmpty(component.getNics())) {
+ for (Nic nic : component.getNics()) {
+ if (nic.getNetworkName() != null && MapUtils.isNotEmpty(networkIdByName)) {
+ nic.setNetworkId(networkIdByName.get(nic.getNetworkName()));
+ }
+ nic.setNetworkName(null);
+ //For heat flow set network type to be internal by default for NIC
+ nic.setNetworkType(NetworkType.Internal);
+ NicEntity nicEntity = new NicEntity(vspId, version, componentId, null);
+ nicEntity.setNicCompositionData(nic);
+ createNic(nicEntity);
+ }
+ }
+ }
- nicDao.create(nic);
- return nic;
- }
+ private Map<String, String> saveNetworks(String vspId, Version version, CompositionData compositionData) {
+ Map<String, String> networkIdByName = new HashMap<>();
+ if (CollectionUtils.isNotEmpty(compositionData.getNetworks())) {
+ for (Network network : compositionData.getNetworks()) {
+ NetworkEntity networkEntity = new NetworkEntity(vspId, version, null);
+ networkEntity.setNetworkCompositionData(network);
+ if (network.getName() != null) {
+ networkIdByName.put(network.getName(), createNetwork(networkEntity).getId());
+ }
+ }
+ }
+ return networkIdByName;
+ }
+ private NetworkEntity createNetwork(NetworkEntity network) {
+ //network.setId(CommonMethods.nextUuId()); will be set by the dao
+ networkDao.create(network);
+ return network;
+ }
- public void addErrorsToTrees(Map<CompositionEntityId, Collection<String>> errors) {
- roots.forEach(root -> addErrorsToTree(root, null, errors));
- }
+ @Override
+ public ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp) {
+ //component.setId(CommonMethods.nextUuId()); will be set by the dao
+ ComponentQuestionnaireSchemaInput schemaInput = new ComponentQuestionnaireSchemaInput(null, null,
+ component.getComponentCompositionData().getDisplayName(), isManualVsp);
+ String questionnarieData = new JsonSchemaDataGenerator(
+ generateSchema(SchemaTemplateContext.questionnaire, CompositionEntityType.component, schemaInput)).generateData();
+ component.setQuestionnaireData(questionnarieData);
+ componentDao.create(component);
+ return component;
+ }
- /* *
- * get a flat list of all questionnaire entities that have validation errors
- * */
- public Set<CompositionEntityValidationData> getEntityListWithErrors() {
- Set<CompositionEntityValidationData> treeAsList = new HashSet<>();
+ @Override
+ public NicEntity createNic(NicEntity nic) {
+ //nic.setId(CommonMethods.nextUuId()); will be set by the dao
+ nic.setQuestionnaireData(
+ new JsonSchemaDataGenerator(generateSchema(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, null)).generateData());
+ nicDao.create(nic);
+ return nic;
+ }
- for (CompositionEntityValidationData entity : roots) {
- if (CollectionUtils.isNotEmpty(entity.getErrors())) {
- addNodeWithErrors(entity, treeAsList);
- }
- getEntityListWithErrors(entity, treeAsList);
+ public void addErrorsToTrees(Map<CompositionEntityId, Collection<String>> errors) {
+ roots.forEach(root -> addErrorsToTree(root, null, errors));
}
- updateValidationCompositionEntityName(treeAsList);
- return treeAsList;
- }
+ /* *
+ * get a flat list of all questionnaire entities that have validation errors
+ * */
+ public Set<CompositionEntityValidationData> getEntityListWithErrors() {
+ Set<CompositionEntityValidationData> treeAsList = new HashSet<>();
+ for (CompositionEntityValidationData entity : roots) {
+ if (CollectionUtils.isNotEmpty(entity.getErrors())) {
+ addNodeWithErrors(entity, treeAsList);
+ }
+ getEntityListWithErrors(entity, treeAsList);
+ }
+ updateValidationCompositionEntityName(treeAsList);
+ return treeAsList;
+ }
- private void getEntityListWithErrors(CompositionEntityValidationData entity,
- Set<CompositionEntityValidationData> compositionSet) {
- if (CollectionUtils.isNotEmpty(entity.getErrors())) {
- addNodeWithErrors(entity, compositionSet);
+ private void getEntityListWithErrors(CompositionEntityValidationData entity, Set<CompositionEntityValidationData> compositionSet) {
+ if (CollectionUtils.isNotEmpty(entity.getErrors())) {
+ addNodeWithErrors(entity, compositionSet);
+ }
+ if (CollectionUtils.isEmpty(entity.getSubEntitiesValidationData())) {
+ return;
+ }
+ for (CompositionEntityValidationData child : entity.getSubEntitiesValidationData()) {
+ getEntityListWithErrors(child, compositionSet);
+ }
}
- if (CollectionUtils.isEmpty(entity.getSubEntitiesValidationData())) {
- return;
+ private void addNodeWithErrors(CompositionEntityValidationData node, Set<CompositionEntityValidationData> entitiesWithErrors) {
+ CompositionEntityValidationData compositionNodeToAdd = new CompositionEntityValidationData(node.getEntityType(), node.getEntityId());
+ compositionNodeToAdd.setErrors(node.getErrors());
+ compositionNodeToAdd.setSubEntitiesValidationData(null);
+ entitiesWithErrors.add(compositionNodeToAdd);
}
- for (CompositionEntityValidationData child : entity.getSubEntitiesValidationData()) {
- getEntityListWithErrors(child, compositionSet);
+ public void removeNodesWithoutErrors() {
+ roots.forEach(root -> removeNodesWithoutErrors(root, null));
}
- }
+ private CompositionEntityData getCompositionEntityDataById(CompositionEntityValidationData entity) {
+ for (Map.Entry<CompositionEntityId, CompositionEntityData> entityEntry : entities.entrySet()) {
+ if (entityEntry.getKey().getId().equals(entity.getEntityId())) {
+ return entityEntry.getValue();
+ }
+ }
+ return null;
+ }
- private void addNodeWithErrors(CompositionEntityValidationData node,
- Set<CompositionEntityValidationData> entitiesWithErrors) {
- CompositionEntityValidationData compositionNodeToAdd = new CompositionEntityValidationData(node
- .getEntityType(), node.getEntityId());
- compositionNodeToAdd.setErrors(node.getErrors());
- compositionNodeToAdd.setSubEntitiesValidationData(null);
+ private void updateValidationCompositionEntityName(Set<CompositionEntityValidationData> compositionSet) {
+ for (CompositionEntityValidationData entity : compositionSet) {
+ String compositionData = getCompositionDataAsString(entity);
+ if (entity.getEntityType().equals(CompositionEntityType.vsp) || Objects.nonNull(compositionData)) {
+ entity.setEntityName(getEntityNameByEntityType(compositionData, entity));
+ }
+ }
+ }
- entitiesWithErrors.add(compositionNodeToAdd);
- }
+ private String getCompositionDataAsString(CompositionEntityValidationData entity) {
+ CompositionEntityData compositionEntityData = getCompositionEntityDataById(entity);
+ return compositionEntityData == null ? null : compositionEntityData.entity.getCompositionData();
+ }
- public void removeNodesWithoutErrors() {
- roots.forEach(root -> removeNodesWithoutErrors(root, null));
- }
+ private String getEntityNameByEntityType(String compositionData, CompositionEntityValidationData entity) {
+ switch (entity.getEntityType()) {
+ case component:
+ ComponentData component = JsonUtil.json2Object(compositionData, ComponentData.class);
+ return component.getDisplayName();
+ case nic:
+ Nic nic = JsonUtil.json2Object(compositionData, Nic.class);
+ return nic.getName();
+ case network:
+ Network network = JsonUtil.json2Object(compositionData, Network.class);
+ return network.getName();
+ case image:
+ Image image = JsonUtil.json2Object(compositionData, Image.class);
+ return image.getFileName();
+ case compute:
+ ComputeData compute = JsonUtil.json2Object(compositionData, ComputeData.class);
+ return compute.getName();
+ case vsp:
+ CompositionEntityData vspEntity = getCompositionEntityDataById(entity);
+ if (Objects.isNull(vspEntity)) {
+ return null;
+ }
+ VspQuestionnaireEntity vspQuestionnaireEntity = (VspQuestionnaireEntity) vspEntity.entity;
+ VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspQuestionnaireEntity.getId(), vspQuestionnaireEntity.getVersion()));
+ return vspDetails.getName();
+ default:
+ return null;
+ }
+ }
+ private void removeNodesWithoutErrors(CompositionEntityValidationData node, CompositionEntityValidationData parent) {
+ if (Objects.isNull(node)) {
+ return;
+ }
+ if (hasChildren(node)) {
+ Collection<CompositionEntityValidationData> subNodes = new ArrayList<>(node.getSubEntitiesValidationData());
+ subNodes.forEach(subNode -> removeNodesWithoutErrors(subNode, node));
+ node.setSubEntitiesValidationData(subNodes);
+ if (canNodeGetRemovedFromValidationDataTree(node)) {
+ removeNodeFromChildren(parent, node);
+ }
+ } else if (canNodeGetRemovedFromValidationDataTree(node)) {
+ removeNodeFromChildren(parent, node);
+ }
+ }
- private CompositionEntityData getCompositionEntityDataById(CompositionEntityValidationData
- entity) {
- for (Map.Entry<CompositionEntityId, CompositionEntityData> entityEntry : entities
- .entrySet()) {
- if (entityEntry.getKey().getId().equals(entity.getEntityId())) {
- return entityEntry.getValue();
- }
+ private void removeNodeFromChildren(CompositionEntityValidationData parent, CompositionEntityValidationData childToRemove) {
+ if (!Objects.isNull(parent)) {
+ parent.getSubEntitiesValidationData().remove(childToRemove);
+ }
}
- return null;
- }
+ private boolean hasChildren(CompositionEntityValidationData node) {
+ return !CollectionUtils.isEmpty(node.getSubEntitiesValidationData());
+ }
- private void updateValidationCompositionEntityName(Set<CompositionEntityValidationData>
- compositionSet) {
- for (CompositionEntityValidationData entity : compositionSet) {
- String compositionData = getCompositionDataAsString(entity);
- if (entity.getEntityType().equals(CompositionEntityType.vsp) ||
- Objects.nonNull(compositionData)) {
- entity.setEntityName(getEntityNameByEntityType(compositionData, entity));
- }
+ private boolean canNodeGetRemovedFromValidationDataTree(CompositionEntityValidationData node) {
+ return !hasChildren(node) && CollectionUtils.isEmpty(node.getErrors());
}
- }
- private String getCompositionDataAsString(CompositionEntityValidationData entity) {
- CompositionEntityData compositionEntityData = getCompositionEntityDataById(entity);
- return compositionEntityData == null ? null : compositionEntityData.entity.getCompositionData();
- }
+ private void addValidationDataEntity(Map<CompositionEntityId, CompositionEntityValidationData> entitiesValidationData,
+ CompositionEntityId entityId, CompositionEntity entity) {
+ if (entitiesValidationData.containsKey(entityId)) {
+ return;
+ }
+ CompositionEntityValidationData validationData = new CompositionEntityValidationData(entity.getType(), entity.getId());
+ entitiesValidationData.put(entityId, validationData);
+ CompositionEntityId parentEntityId = entityId.getParentId();
+ if (parentEntityId == null) {
+ roots.add(validationData);
+ } else {
+ CompositionEntityData parentEntity = entities.get(parentEntityId);
+ if (parentEntity == null) {
+ roots.add(validationData);
+ } else {
+ addValidationDataEntity(entitiesValidationData, parentEntityId, parentEntity.entity);
+ entitiesValidationData.get(parentEntityId).addSubEntityValidationData(validationData);
+ }
+ }
+ }
+ private void addErrorsToTree(CompositionEntityValidationData node, CompositionEntityId parentNodeId,
+ Map<CompositionEntityId, Collection<String>> errors) {
+ if (node == null) {
+ return;
+ }
+ CompositionEntityId nodeId = new CompositionEntityId(node.getEntityId(), parentNodeId);
+ node.setErrors(errors.get(nodeId));
+ if (node.getSubEntitiesValidationData() != null) {
+ node.getSubEntitiesValidationData().forEach(subNode -> addErrorsToTree(subNode, nodeId, errors));
+ }
+ }
- private String getEntityNameByEntityType(String compositionData,
- CompositionEntityValidationData entity) {
- switch (entity.getEntityType()) {
- case component:
- ComponentData component = JsonUtil.json2Object(compositionData, ComponentData.class);
- return component.getDisplayName();
+ private Collection<String> validateQuestionnaire(CompositionEntityData compositionEntityData) {
+ logger.debug(String.format("validateQuestionnaire start: " + "[entity.type]=%s, [entity.id]=%s, [entity.questionnaireString]=%s",
+ compositionEntityData.entity.getType().name(), compositionEntityData.entity.getCompositionEntityId().toString(),
+ compositionEntityData.entity.getQuestionnaireData()));
+ if (Objects.isNull(compositionEntityData.entity.getQuestionnaireData()) || !JsonUtil
+ .isValidJson(compositionEntityData.entity.getQuestionnaireData())) {
+ return Collections.singletonList(String.format(MISSING_OR_INVALID_QUESTIONNAIRE_MSG, compositionEntityData.entity.getType()));
+ }
+ return JsonUtil.validate(compositionEntityData.entity.getQuestionnaireData() == null ? JsonUtil.object2Json(new Object())
+ : compositionEntityData.entity.getQuestionnaireData(),
+ getSchema(compositionEntityData.entity.getType(), SchemaTemplateContext.questionnaire, compositionEntityData.schemaTemplateInput));
+ }
- case nic:
- Nic nic = JsonUtil.json2Object(compositionData, Nic.class);
- return nic.getName();
+ private String getSchema(CompositionEntityType compositionEntityType, SchemaTemplateContext schemaTemplateContext,
+ SchemaTemplateInput schemaTemplateInput) {
+ return schemaTemplateInput == null ? nonDynamicSchemas
+ .computeIfAbsent(compositionEntityType, k -> generateSchema(schemaTemplateContext, compositionEntityType, null))
+ : generateSchema(schemaTemplateContext, compositionEntityType, schemaTemplateInput);
+ }
- case network:
- Network network = JsonUtil.json2Object(compositionData, Network.class);
- return network.getName();
+ // make the method private
+ protected String generateSchema(SchemaTemplateContext schemaTemplateContext, CompositionEntityType compositionEntityType,
+ SchemaTemplateInput schemaTemplateInput) {
+ return SchemaGenerator.generate(schemaTemplateContext, compositionEntityType, schemaTemplateInput);
+ }
+ // todo - make SchemaGenerator non static and mock it in UT instead of mocking this method (and
- case image:
- Image image = JsonUtil.json2Object(compositionData, Image.class);
- return image.getFileName();
+ @Override
+ public DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor) {
+ deploymentFlavor.setId(CommonMethods.nextUuId());
+ deploymentFlavorDao.create(deploymentFlavor);
+ return deploymentFlavor;
+ }
- case compute:
- ComputeData compute = JsonUtil.json2Object(compositionData, ComputeData.class);
- return compute.getName();
+ @Override
+ public ImageEntity createImage(ImageEntity image) {
+ image.setId(CommonMethods.nextUuId());
+ image.setQuestionnaireData(
+ new JsonSchemaDataGenerator(SchemaGenerator.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image, null))
+ .generateData());
+ imageDao.create(image);
+ return image;
+ }
- case vsp:
- CompositionEntityData vspEntity = getCompositionEntityDataById(entity);
- if (Objects.isNull(vspEntity)) {
- return null;
+ public void saveComputesFlavorByComponent(String vspId, Version version, Component component, String componentId) {
+ if (CollectionUtils.isNotEmpty(component.getCompute())) {
+ for (ComputeData flavor : component.getCompute()) {
+ ComputeEntity computeEntity = new ComputeEntity(vspId, version, componentId, null);
+ computeEntity.setComputeCompositionData(flavor);
+ computeEntity.setQuestionnaireData(
+ new JsonSchemaDataGenerator(SchemaGenerator.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute, null))
+ .generateData());
+ computeDao.create(computeEntity);
+ }
}
- VspQuestionnaireEntity vspQuestionnaireEntity = (VspQuestionnaireEntity) vspEntity.entity;
- VspDetails vspDetails =
- vspInfoDao.get(new VspDetails(vspQuestionnaireEntity.getId(),
- vspQuestionnaireEntity.getVersion()));
- return vspDetails.getName();
- default:
- return null;
- }
- }
-
- private void removeNodesWithoutErrors(CompositionEntityValidationData node,
- CompositionEntityValidationData parent) {
-
- if (Objects.isNull(node)) {
- return;
}
- if (hasChildren(node)) {
- Collection<CompositionEntityValidationData> subNodes =
- new ArrayList<>(node.getSubEntitiesValidationData());
- subNodes.forEach(subNode -> removeNodesWithoutErrors(subNode, node));
- node.setSubEntitiesValidationData(subNodes);
-
- if (canNodeGetRemovedFromValidationDataTree(node)) {
- removeNodeFromChildren(parent, node);
- }
- } else if (canNodeGetRemovedFromValidationDataTree(node)) {
- removeNodeFromChildren(parent, node);
+ public void saveImagesByComponent(String vspId, Version version, Component component, String componentId) {
+ if (CollectionUtils.isNotEmpty(component.getImages())) {
+ for (Image img : component.getImages()) {
+ ImageEntity imageEntity = new ImageEntity(vspId, version, componentId, null);
+ imageEntity.setImageCompositionData(img);
+ createImage(imageEntity);
+ }
+ }
}
- }
- private void removeNodeFromChildren(CompositionEntityValidationData parent,
- CompositionEntityValidationData childToRemove) {
- if (!Objects.isNull(parent)) {
- parent.getSubEntitiesValidationData().remove(childToRemove);
- }
- }
+ private static class CompositionEntityData {
- private boolean hasChildren(CompositionEntityValidationData node) {
- return !CollectionUtils.isEmpty(node.getSubEntitiesValidationData());
- }
-
- private boolean canNodeGetRemovedFromValidationDataTree(CompositionEntityValidationData node) {
- return !hasChildren(node) && CollectionUtils.isEmpty(node.getErrors());
- }
-
-
- private void addValidationDataEntity(
- Map<CompositionEntityId, CompositionEntityValidationData> entitiesValidationData,
- CompositionEntityId entityId, CompositionEntity entity) {
- if (entitiesValidationData.containsKey(entityId)) {
- return;
- }
-
- CompositionEntityValidationData validationData =
- new CompositionEntityValidationData(entity.getType(), entity.getId());
- entitiesValidationData.put(entityId, validationData);
-
- CompositionEntityId parentEntityId = entityId.getParentId();
- if (parentEntityId == null) {
- roots.add(validationData);
- } else {
- CompositionEntityData parentEntity = entities.get(parentEntityId);
- if (parentEntity == null) {
- roots.add(validationData);
- } else {
- addValidationDataEntity(entitiesValidationData, parentEntityId, parentEntity.entity);
- entitiesValidationData.get(parentEntityId).addSubEntityValidationData(validationData);
- }
- }
- }
-
- private void addErrorsToTree(CompositionEntityValidationData node,
- CompositionEntityId parentNodeId,
- Map<CompositionEntityId, Collection<String>> errors) {
- if (node == null) {
- return;
- }
- CompositionEntityId nodeId = new CompositionEntityId(node.getEntityId(), parentNodeId);
- node.setErrors(errors.get(nodeId));
-
- if (node.getSubEntitiesValidationData() != null) {
- node.getSubEntitiesValidationData()
- .forEach(subNode -> addErrorsToTree(subNode, nodeId, errors));
- }
- }
-
- private Collection<String> validateQuestionnaire(CompositionEntityData compositionEntityData) {
- logger.debug(String.format("validateQuestionnaire start: " +
- "[entity.type]=%s, [entity.id]=%s, [entity.questionnaireString]=%s",
- compositionEntityData.entity.getType().name(),
- compositionEntityData.entity.getCompositionEntityId().toString(),
- compositionEntityData.entity.getQuestionnaireData()));
-
- if (Objects.isNull(compositionEntityData.entity.getQuestionnaireData()) ||
- !JsonUtil.isValidJson(compositionEntityData.entity.getQuestionnaireData())) {
- return Collections.singletonList(String
- .format(MISSING_OR_INVALID_QUESTIONNAIRE_MSG, compositionEntityData.entity.getType()));
- }
-
- return JsonUtil.validate(
- compositionEntityData.entity.getQuestionnaireData() == null
- ? JsonUtil.object2Json(new Object())
- : compositionEntityData.entity.getQuestionnaireData(),
- getSchema(compositionEntityData.entity.getType(), SchemaTemplateContext.questionnaire,
- compositionEntityData.schemaTemplateInput));
- }
-
- private String getSchema(CompositionEntityType compositionEntityType,
- SchemaTemplateContext schemaTemplateContext,
- SchemaTemplateInput schemaTemplateInput) {
- return schemaTemplateInput == null
- ? nonDynamicSchemas.computeIfAbsent(compositionEntityType,
- k -> generateSchema(schemaTemplateContext, compositionEntityType, null))
- : generateSchema(schemaTemplateContext, compositionEntityType, schemaTemplateInput);
- }
-
- private static class CompositionEntityData {
- private CompositionEntity entity;
- private SchemaTemplateInput schemaTemplateInput;
-
- CompositionEntityData(CompositionEntity entity, SchemaTemplateInput schemaTemplateInput) {
- this.entity = entity;
- this.schemaTemplateInput = schemaTemplateInput;
- }
-
- }
-
- // todo - make SchemaGenerator non static and mock it in UT instead of mocking this method (and
- // make the method private
- protected String generateSchema(SchemaTemplateContext schemaTemplateContext,
- CompositionEntityType compositionEntityType,
- SchemaTemplateInput schemaTemplateInput) {
- return SchemaGenerator
- .generate(schemaTemplateContext, compositionEntityType, schemaTemplateInput);
- }
-
- @Override
- public DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavor) {
- deploymentFlavor.setId(CommonMethods.nextUuId());
- deploymentFlavorDao.create(deploymentFlavor);
- return deploymentFlavor;
- }
-
- @Override
- public ImageEntity createImage(ImageEntity image) {
- image.setId(CommonMethods.nextUuId());
-
- image.setQuestionnaireData(
- new JsonSchemaDataGenerator(SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image, null))
- .generateData());
-
- imageDao.create(image);
- return image;
- }
-
- public void saveComputesFlavorByComponent(String vspId, Version version, Component component,
- String componentId) {
- if (CollectionUtils.isNotEmpty(component.getCompute())) {
- for (ComputeData flavor : component.getCompute()) {
- ComputeEntity computeEntity = new ComputeEntity(vspId, version, componentId, null);
- computeEntity.setComputeCompositionData(flavor);
- computeEntity.setQuestionnaireData(
- new JsonSchemaDataGenerator(SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute,
- null)).generateData());
-
- computeDao.create(computeEntity);
- }
- }
- }
-
- public void saveImagesByComponent(String vspId, Version version, Component component, String
- componentId) {
- if (CollectionUtils.isNotEmpty(component.getImages())) {
- for (Image img : component.getImages()) {
- ImageEntity imageEntity = new ImageEntity(vspId, version, componentId, null);
- imageEntity.setImageCompositionData(img);
- createImage(imageEntity);
- }
- }
- }
+ private CompositionEntity entity;
+ private SchemaTemplateInput schemaTemplateInput;
+ CompositionEntityData(CompositionEntity entity, SchemaTemplateInput schemaTemplateInput) {
+ this.entity = entity;
+ this.schemaTemplateInput = schemaTemplateInput;
+ }
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java
index 4a1b1c1cff..c0b6fda818 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
@@ -29,15 +28,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoF
public class ComputeManagerFactoryImpl extends ComputeManagerFactory {
- private static final ComputeManager INSTANCE =
- new ComputeManagerImpl(
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- ComputeDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
- DeploymentFlavorDaoFactory.getInstance().createInterface());
+ private static final ComputeManager INSTANCE = new ComputeManagerImpl(VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
+ ComputeDaoFactory.getInstance().createInterface(), CompositionEntityDataManagerFactory.getInstance().createInterface(),
+ DeploymentFlavorDaoFactory.getInstance().createInterface());
- @Override
- public ComputeManager createInterface() {
- return INSTANCE;
- }
+ @Override
+ public ComputeManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
index 8bddeaeef4..6c319ca866 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java
@@ -13,10 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.dao.UniqueValueDaoFactory;
import org.openecomp.core.util.UniqueValueUtil;
@@ -38,279 +41,223 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGe
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.*;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComputeCompositionSchemaInput;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.*;
-
public class ComputeManagerImpl implements ComputeManager {
- private final ComputeDao computeDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- private final VendorSoftwareProductInfoDao vspInfoDao;
- private final DeploymentFlavorDao deploymentFlavorDao;
-
- public ComputeManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
- ComputeDao computeDao,
- CompositionEntityDataManager compositionEntityDataManager,
- DeploymentFlavorDao deploymentFlavorDao) {
- this.computeDao = computeDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.vspInfoDao = vspInfoDao;
- this.deploymentFlavorDao = deploymentFlavorDao;
- }
-
- @Override
- public ComputeEntity createCompute(ComputeEntity compute) {
- if (!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
- ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
- .getAddComputeNotSupportedHeatOnboardMethodErrorBuilder();
- throw new CoreException(onboardingMethodUpdateErrorCode);
- } else {
- validateUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
- compute.getComputeCompositionData().getName());
- compute.setQuestionnaireData(
- new JsonSchemaDataGenerator(getComputeQuestionnaireSchema(null)).generateData());
- computeDao.create(compute);
- createUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
- compute.getComputeCompositionData().getName());
+ private final ComputeDao computeDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+ private final DeploymentFlavorDao deploymentFlavorDao;
+
+ public ComputeManagerImpl(VendorSoftwareProductInfoDao vspInfoDao, ComputeDao computeDao,
+ CompositionEntityDataManager compositionEntityDataManager, DeploymentFlavorDao deploymentFlavorDao) {
+ this.computeDao = computeDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
+ this.vspInfoDao = vspInfoDao;
+ this.deploymentFlavorDao = deploymentFlavorDao;
}
- return compute;
- }
+ @Override
+ public ComputeEntity createCompute(ComputeEntity compute) {
+ if (!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
+ ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
+ .getAddComputeNotSupportedHeatOnboardMethodErrorBuilder();
+ throw new CoreException(onboardingMethodUpdateErrorCode);
+ } else {
+ validateUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(), compute.getComputeCompositionData().getName());
+ compute.setQuestionnaireData(new JsonSchemaDataGenerator(getComputeQuestionnaireSchema(null)).generateData());
+ computeDao.create(compute);
+ createUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(), compute.getComputeCompositionData().getName());
+ }
+ return compute;
+ }
- @Override
- public Collection<ListComputeResponse> listComputes(String vspId, Version version,
- String componentId) {
- Collection<ComputeEntity> computes =
- computeDao.list(new ComputeEntity(vspId, version, componentId, null));
- return getListComputeResponse(vspId, version, computes);
- }
-
- private Collection<ListComputeResponse> getListComputeResponse(String vspId, Version version,
- Collection<ComputeEntity> computes) {
- Set<String> vspComputes = getComputeAssociatedWithDepFlavors(vspId, version);
- Collection<ListComputeResponse> computeResponse = new ArrayList<>();
- for (ComputeEntity computeEntity : computes) {
- ListComputeResponse response = new ListComputeResponse();
- response.setComputeEntity(computeEntity);
- if (vspComputes.contains(computeEntity.getId())) {
- response.setAssociatedWithDeploymentFlavor(true);
- } else {
- response.setAssociatedWithDeploymentFlavor(false);
- }
- computeResponse.add(response);
+ @Override
+ public Collection<ListComputeResponse> listComputes(String vspId, Version version, String componentId) {
+ Collection<ComputeEntity> computes = computeDao.list(new ComputeEntity(vspId, version, componentId, null));
+ return getListComputeResponse(vspId, version, computes);
}
- return computeResponse;
- }
- private Set<String> getComputeAssociatedWithDepFlavors(String vspId, Version version) {
- final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
- deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
- Set<String> vspComputes = new HashSet<>();
- for (DeploymentFlavorEntity entity : deploymentFlavorEntities) {
- final List<ComponentComputeAssociation> componentComputeAssociations =
- entity.getDeploymentFlavorCompositionData().getComponentComputeAssociations();
- if (componentComputeAssociations != null && !componentComputeAssociations.isEmpty()) {
- for (ComponentComputeAssociation association : componentComputeAssociations) {
- vspComputes.add(association.getComputeFlavorId());
+ private Collection<ListComputeResponse> getListComputeResponse(String vspId, Version version, Collection<ComputeEntity> computes) {
+ Set<String> vspComputes = getComputeAssociatedWithDepFlavors(vspId, version);
+ Collection<ListComputeResponse> computeResponse = new ArrayList<>();
+ for (ComputeEntity computeEntity : computes) {
+ ListComputeResponse response = new ListComputeResponse();
+ response.setComputeEntity(computeEntity);
+ if (vspComputes.contains(computeEntity.getId())) {
+ response.setAssociatedWithDeploymentFlavor(true);
+ } else {
+ response.setAssociatedWithDeploymentFlavor(false);
+ }
+ computeResponse.add(response);
}
- }
+ return computeResponse;
}
- return vspComputes;
- }
- @Override
- public CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version,
- String componentId,
- String computeFlavorId) {
- ComputeEntity computeEntity = getValidatedCompute(vspId, version, componentId, computeFlavorId);
- ComputeData compute = computeEntity.getComputeCompositionData();
-
- ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(vspId, version));
- schemaInput.setCompute(compute);
-
- CompositionEntityResponse<ComputeData> response = new CompositionEntityResponse<>();
- response.setId(computeFlavorId);
- response.setData(compute);
- response.setSchema(getComputeCompositionSchema(schemaInput));
- return response;
- }
-
- private ComputeEntity getValidatedCompute(String vspId, Version version, String componentId,
- String computeFlavorId) {
- ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId,
- computeFlavorId));
- VersioningUtil
- .validateEntityExistence(retrieved, new ComputeEntity(vspId, version, componentId,
- computeFlavorId), VspDetails.ENTITY_TYPE);
- return retrieved;
- }
-
- @Override
- public QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String
- componentId, String computeId) {
- QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
- ComputeEntity computeQuestionnaire =
- computeDao.getQuestionnaireData(vspId, version, componentId, computeId);
- VersioningUtil
- .validateEntityExistence(computeQuestionnaire,
- new ComputeEntity(vspId, version, componentId, computeId), VspDetails.ENTITY_TYPE);
- questionnaireResponse.setData(computeQuestionnaire.getQuestionnaireData());
- questionnaireResponse.setSchema(getComputeQuestionnaireSchema(null));
- return questionnaireResponse;
- }
-
-
- @Override
- public void updateComputeQuestionnaire(String vspId, Version version, String componentId,
- String computeId, String questionnaireData) {
- ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId,
- computeId));
- VersioningUtil.validateEntityExistence(retrieved, new ComputeEntity(vspId, version,
- componentId, computeId), VspDetails.ENTITY_TYPE);
-
- computeDao.updateQuestionnaireData(vspId, version, componentId, computeId, questionnaireData);
- }
+ private Set<String> getComputeAssociatedWithDepFlavors(String vspId, Version version) {
+ final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deploymentFlavorDao
+ .list(new DeploymentFlavorEntity(vspId, version, null));
+ Set<String> vspComputes = new HashSet<>();
+ for (DeploymentFlavorEntity entity : deploymentFlavorEntities) {
+ final List<ComponentComputeAssociation> componentComputeAssociations = entity.getDeploymentFlavorCompositionData()
+ .getComponentComputeAssociations();
+ if (componentComputeAssociations != null && !componentComputeAssociations.isEmpty()) {
+ for (ComponentComputeAssociation association : componentComputeAssociations) {
+ vspComputes.add(association.getComputeFlavorId());
+ }
+ }
+ }
+ return vspComputes;
+ }
- @Override
- public CompositionEntityValidationData updateCompute(ComputeEntity compute) {
- ComputeEntity retrieved =
- getComputeEntity(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
- compute.getId());
+ @Override
+ public CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version, String componentId, String computeFlavorId) {
+ ComputeEntity computeEntity = getValidatedCompute(vspId, version, componentId, computeFlavorId);
+ ComputeData compute = computeEntity.getComputeCompositionData();
+ ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+ schemaInput.setCompute(compute);
+ CompositionEntityResponse<ComputeData> response = new CompositionEntityResponse<>();
+ response.setId(computeFlavorId);
+ response.setData(compute);
+ response.setSchema(getComputeCompositionSchema(schemaInput));
+ return response;
+ }
- boolean manual = vspInfoDao.isManual(compute.getVspId(), compute.getVersion());
+ private ComputeEntity getValidatedCompute(String vspId, Version version, String componentId, String computeFlavorId) {
+ ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId, computeFlavorId));
+ VersioningUtil.validateEntityExistence(retrieved, new ComputeEntity(vspId, version, componentId, computeFlavorId), VspDetails.ENTITY_TYPE);
+ return retrieved;
+ }
- ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
- schemaInput.setManual(manual);
- schemaInput.setCompute(retrieved.getComputeCompositionData());
+ @Override
+ public QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String componentId, String computeId) {
+ QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
+ ComputeEntity computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, computeId);
+ VersioningUtil
+ .validateEntityExistence(computeQuestionnaire, new ComputeEntity(vspId, version, componentId, computeId), VspDetails.ENTITY_TYPE);
+ questionnaireResponse.setData(computeQuestionnaire.getQuestionnaireData());
+ questionnaireResponse.setSchema(getComputeQuestionnaireSchema(null));
+ return questionnaireResponse;
+ }
- CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(compute, SchemaTemplateContext.composition, schemaInput);
- if (CollectionUtils.isEmpty(validationData.getErrors())) {
- updateUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
- retrieved.getComputeCompositionData().getName(),
- compute.getComputeCompositionData().getName());
- computeDao.update(compute);
+ @Override
+ public void updateComputeQuestionnaire(String vspId, Version version, String componentId, String computeId, String questionnaireData) {
+ ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId, computeId));
+ VersioningUtil.validateEntityExistence(retrieved, new ComputeEntity(vspId, version, componentId, computeId), VspDetails.ENTITY_TYPE);
+ computeDao.updateQuestionnaireData(vspId, version, componentId, computeId, questionnaireData);
}
- return validationData;
- }
- private ComputeEntity getComputeEntity(String vspId, Version version, String componentId,
- String computeId) {
- ComputeEntity computeEntity =
- computeDao.get(new ComputeEntity(vspId, version, componentId, computeId));
- VersioningUtil
- .validateEntityExistence(computeEntity, new ComputeEntity(vspId, version, componentId,
- computeId), VspDetails.ENTITY_TYPE);
- return computeEntity;
- }
+ @Override
+ public CompositionEntityValidationData updateCompute(ComputeEntity compute) {
+ ComputeEntity retrieved = getComputeEntity(compute.getVspId(), compute.getVersion(), compute.getComponentId(), compute.getId());
+ boolean manual = vspInfoDao.isManual(compute.getVspId(), compute.getVersion());
+ ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
+ schemaInput.setManual(manual);
+ schemaInput.setCompute(retrieved.getComputeCompositionData());
+ CompositionEntityValidationData validationData = compositionEntityDataManager
+ .validateEntity(compute, SchemaTemplateContext.composition, schemaInput);
+ if (CollectionUtils.isEmpty(validationData.getErrors())) {
+ updateUniqueName(compute.getVspId(), compute.getVersion(), compute.getComponentId(), retrieved.getComputeCompositionData().getName(),
+ compute.getComputeCompositionData().getName());
+ computeDao.update(compute);
+ }
+ return validationData;
+ }
- @Override
- public void deleteCompute(String vspId, Version version, String componentId,
- String computeFlavorId) {
- final String vspCompositionEditNotAllowedMsg =
- "Composition entities may not be created / deleted for Vendor Software Product "
- + "whose entities were uploaded";
- if (!vspInfoDao.isManual(vspId, version)) {
- throw new CoreException(
- new ErrorCode.ErrorCodeBuilder()
- .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED)
- .withMessage(vspCompositionEditNotAllowedMsg).build());
+ private ComputeEntity getComputeEntity(String vspId, Version version, String componentId, String computeId) {
+ ComputeEntity computeEntity = computeDao.get(new ComputeEntity(vspId, version, componentId, computeId));
+ VersioningUtil.validateEntityExistence(computeEntity, new ComputeEntity(vspId, version, componentId, computeId), VspDetails.ENTITY_TYPE);
+ return computeEntity;
}
- ComputeEntity retrieved = getValidatedCompute(vspId, version, componentId, computeFlavorId);
- if (retrieved != null) {
- deleteComputeFromDeploymentFlavors(vspId, version, computeFlavorId);
- computeDao.delete(new ComputeEntity(vspId, version, componentId, computeFlavorId));
- deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
- retrieved.getComputeCompositionData().getName());
+
+ @Override
+ public void deleteCompute(String vspId, Version version, String componentId, String computeFlavorId) {
+ final String vspCompositionEditNotAllowedMsg =
+ "Composition entities may not be created / deleted for Vendor Software Product " + "whose entities were uploaded";
+ if (!vspInfoDao.isManual(vspId, version)) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED)
+ .withMessage(vspCompositionEditNotAllowedMsg).build());
+ }
+ ComputeEntity retrieved = getValidatedCompute(vspId, version, componentId, computeFlavorId);
+ if (retrieved != null) {
+ deleteComputeFromDeploymentFlavors(vspId, version, computeFlavorId);
+ computeDao.delete(new ComputeEntity(vspId, version, componentId, computeFlavorId));
+ deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
+ retrieved.getComputeCompositionData().getName());
+ }
}
- }
- private void deleteComputeFromDeploymentFlavors(String vspId, Version version,
- String computeFlavorId) {
- Collection<DeploymentFlavorEntity> listDF =
- deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
- for (DeploymentFlavorEntity df : listDF) {
- DeploymentFlavorEntity deploymentFlavorEntity = removeComputeFromDF(df, computeFlavorId);
- if (deploymentFlavorEntity != null) {
- deploymentFlavorDao.update(deploymentFlavorEntity);
- }
+ private void deleteComputeFromDeploymentFlavors(String vspId, Version version, String computeFlavorId) {
+ Collection<DeploymentFlavorEntity> listDF = deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
+ for (DeploymentFlavorEntity df : listDF) {
+ DeploymentFlavorEntity deploymentFlavorEntity = removeComputeFromDF(df, computeFlavorId);
+ if (deploymentFlavorEntity != null) {
+ deploymentFlavorDao.update(deploymentFlavorEntity);
+ }
+ }
}
- }
- private DeploymentFlavorEntity removeComputeFromDF(DeploymentFlavorEntity df,
- String computeFlavorId) {
- DeploymentFlavor flavor = df.getDeploymentFlavorCompositionData();
- List<ComponentComputeAssociation> associations = flavor.getComponentComputeAssociations();
- if (associations != null) {
- List<ComponentComputeAssociation> updatedAssociations = new ArrayList<>();
- for (ComponentComputeAssociation ca : associations) {
- if (ca.getComputeFlavorId() != null && ca.getComputeFlavorId().equals(computeFlavorId)) {
- ComponentComputeAssociation updateCaremoveCompute = new ComponentComputeAssociation();
- updateCaremoveCompute.setComponentId(ca.getComponentId());
- updatedAssociations.add(updateCaremoveCompute);
- } else {
- updatedAssociations.add(ca);
+ private DeploymentFlavorEntity removeComputeFromDF(DeploymentFlavorEntity df, String computeFlavorId) {
+ DeploymentFlavor flavor = df.getDeploymentFlavorCompositionData();
+ List<ComponentComputeAssociation> associations = flavor.getComponentComputeAssociations();
+ if (associations != null) {
+ List<ComponentComputeAssociation> updatedAssociations = new ArrayList<>();
+ for (ComponentComputeAssociation ca : associations) {
+ if (ca.getComputeFlavorId() != null && ca.getComputeFlavorId().equals(computeFlavorId)) {
+ ComponentComputeAssociation updateCaremoveCompute = new ComponentComputeAssociation();
+ updateCaremoveCompute.setComponentId(ca.getComponentId());
+ updatedAssociations.add(updateCaremoveCompute);
+ } else {
+ updatedAssociations.add(ca);
+ }
+ }
+ flavor.setComponentComputeAssociations(updatedAssociations);
+ df.setDeploymentFlavorCompositionData(flavor);
+ return df;
}
- }
- flavor.setComponentComputeAssociations(updatedAssociations);
- df.setDeploymentFlavorCompositionData(flavor);
- return df;
+ return null;
}
- return null;
- }
- protected String getComputeCompositionSchema(SchemaTemplateInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.compute, schemaInput);
- }
+ protected String getComputeCompositionSchema(SchemaTemplateInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.compute, schemaInput);
+ }
- protected String getComputeQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute, schemaInput);
- }
+ protected String getComputeQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute, schemaInput);
+ }
- protected void validateUniqueName(String vspId, Version version, String componentId,
- String name) {
- UniqueValueUtil uniqueValueUtil =
- new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
- uniqueValueUtil.validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME,
- vspId, version.getId(), componentId, name);
- }
+ protected void validateUniqueName(String vspId, Version version, String componentId, String name) {
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ uniqueValueUtil.validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId, version.getId(), componentId, name);
+ }
- protected void createUniqueName(String vspId, Version version, String componentId, String name) {
- UniqueValueUtil uniqueValueUtil =
- new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
- uniqueValueUtil
- .createUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId,
- version.getId(), componentId, name);
- }
+ protected void createUniqueName(String vspId, Version version, String componentId, String name) {
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ uniqueValueUtil.createUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId, version.getId(), componentId, name);
+ }
- protected void updateUniqueName(String vspId, Version version, String componentId,
- String oldName, String newName) {
- UniqueValueUtil uniqueValueUtil =
- new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
- uniqueValueUtil
- .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, oldName,
- newName, vspId, version.getId(), componentId);
- }
+ protected void updateUniqueName(String vspId, Version version, String componentId, String oldName, String newName) {
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ uniqueValueUtil
+ .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, oldName, newName, vspId, version.getId(), componentId);
+ }
- protected void deleteUniqueValue(String vspId, Version version, String componentId, String name) {
- UniqueValueUtil uniqueValueUtil =
- new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
- if (componentId == null) {
- uniqueValueUtil
- .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId,
- version.getId(), name);
+ protected void deleteUniqueValue(String vspId, Version version, String componentId, String name) {
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ if (componentId == null) {
+ uniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId, version.getId(), name);
+ }
+ uniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId, version.getId(), componentId, name);
}
- uniqueValueUtil
- .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId,
- version.getId(), componentId, name);
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java
index dde07d43b7..fc2db3a478 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager;
import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory;
@@ -27,16 +25,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoF
public class DeploymentFlavorManagerFactoryImpl extends DeploymentFlavorManagerFactory {
- private static final DeploymentFlavorManager INSTANCE = new DeploymentFlavorManagerImpl(
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- DeploymentFlavorDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
- ComputeDaoFactory.getInstance().createInterface(),
- ComponentDaoFactory.getInstance().createInterface()
- );
+ private static final DeploymentFlavorManager INSTANCE = new DeploymentFlavorManagerImpl(
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(), DeploymentFlavorDaoFactory.getInstance().createInterface(),
+ CompositionEntityDataManagerFactory.getInstance().createInterface(), ComputeDaoFactory.getInstance().createInterface(),
+ ComponentDaoFactory.getInstance().createInterface());
- @Override
- public DeploymentFlavorManager createInterface() {
- return INSTANCE;
- }
+ @Override
+ public DeploymentFlavorManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
index 69d8a364db..e3f8f04bb1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import java.util.ArrayList;
@@ -21,7 +20,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.openecomp.sdc.common.errors.CoreException;
@@ -49,292 +47,218 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.*;
-
public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
- private final VendorSoftwareProductInfoDao vspInfoDao;
- private final DeploymentFlavorDao deploymentFlavorDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- private final ComputeDao computeDao;
- private final ComponentDao componentDao;
-
- public DeploymentFlavorManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
- DeploymentFlavorDao deploymentFlavorDao,
- CompositionEntityDataManager compositionEntityDataManager,
- ComputeDao computeDao, ComponentDao componentDao) {
- this.vspInfoDao = vspInfoDao;
- this.deploymentFlavorDao = deploymentFlavorDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.computeDao = computeDao;
- this.componentDao = componentDao;
-
- }
- @Override
- public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
- return deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
- }
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+ private final DeploymentFlavorDao deploymentFlavorDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
+ private final ComputeDao computeDao;
+ private final ComponentDao componentDao;
+
+ public DeploymentFlavorManagerImpl(VendorSoftwareProductInfoDao vspInfoDao, DeploymentFlavorDao deploymentFlavorDao,
+ CompositionEntityDataManager compositionEntityDataManager, ComputeDao computeDao, ComponentDao componentDao) {
+ this.vspInfoDao = vspInfoDao;
+ this.deploymentFlavorDao = deploymentFlavorDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
+ this.computeDao = computeDao;
+ this.componentDao = componentDao;
+ }
- @Override
- public DeploymentFlavorEntity createDeploymentFlavor(
- DeploymentFlavorEntity deploymentFlavorEntity) {
- DeploymentFlavorEntity createDeploymentFlavor;
- if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion())) {
- ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
- .getAddDeploymentNotSupportedHeatOnboardErrorBuilder();
- throw new CoreException(deploymentFlavorErrorBuilder);
- } else {
- validateDeploymentFlavor(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
- createDeploymentFlavor =
- compositionEntityDataManager.createDeploymentFlavor(deploymentFlavorEntity);
+ @Override
+ public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
+ return deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
}
- return createDeploymentFlavor;
- }
- private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity,
- Version version) {
- //Validation for unique model.
- Collection<DeploymentFlavorEntity> listDeploymentFlavors =
- listDeploymentFlavors(deploymentFlavorEntity.getVspId(),
- version);
- isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
+ @Override
+ public DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity) {
+ DeploymentFlavorEntity createDeploymentFlavor;
+ if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion())) {
+ ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder.getAddDeploymentNotSupportedHeatOnboardErrorBuilder();
+ throw new CoreException(deploymentFlavorErrorBuilder);
+ } else {
+ validateDeploymentFlavor(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
+ createDeploymentFlavor = compositionEntityDataManager.createDeploymentFlavor(deploymentFlavorEntity);
+ }
+ return createDeploymentFlavor;
+ }
- List<String> featureGroups =
- getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), version);
- String featureGroup = deploymentFlavorEntity.getDeploymentFlavorCompositionData()
- .getFeatureGroupId();
- if (featureGroup != null && featureGroup.trim().length() > 0
- && (isEmpty(featureGroups) || (!(validFeatureGroup(featureGroups, featureGroup))))) {
- ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
- .getFeatureGroupNotexistErrorBuilder();
- throw new CoreException(deploymentFlavorErrorBuilder);
+ private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity, Version version) {
+ //Validation for unique model.
+ Collection<DeploymentFlavorEntity> listDeploymentFlavors = listDeploymentFlavors(deploymentFlavorEntity.getVspId(), version);
+ isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
+ List<String> featureGroups = getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), version);
+ String featureGroup = deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId();
+ if (featureGroup != null && featureGroup.trim().length() > 0 && (isEmpty(featureGroups) || (!(validFeatureGroup(featureGroups,
+ featureGroup))))) {
+ ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder.getFeatureGroupNotexistErrorBuilder();
+ throw new CoreException(deploymentFlavorErrorBuilder);
+ }
+ validateComponentComputeAssociation(deploymentFlavorEntity, version);
}
- validateComponentComputeAssociation(deploymentFlavorEntity, version);
- }
- private void isDeploymentFlavorModelDuplicate(DeploymentFlavorEntity deploymentFlavorEntity,
- Collection<DeploymentFlavorEntity> listDeploymentFlavors) {
- listDeploymentFlavors.forEach(deploymentFlavor -> {
- if (deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().equalsIgnoreCase(
- deploymentFlavor.getDeploymentFlavorCompositionData().getModel())) {
- ErrorCode deploymentFlavorModelErrorBuilder = DeploymentFlavorErrorBuilder
- .getDuplicateDeploymentFlavorModelErrorBuilder(
- deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel(),
- deploymentFlavorEntity.getVspId());
- throw new CoreException(deploymentFlavorModelErrorBuilder);
- }
- });
- }
+ private void isDeploymentFlavorModelDuplicate(DeploymentFlavorEntity deploymentFlavorEntity,
+ Collection<DeploymentFlavorEntity> listDeploymentFlavors) {
+ listDeploymentFlavors.forEach(deploymentFlavor -> {
+ if (deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel()
+ .equalsIgnoreCase(deploymentFlavor.getDeploymentFlavorCompositionData().getModel())) {
+ ErrorCode deploymentFlavorModelErrorBuilder = DeploymentFlavorErrorBuilder
+ .getDuplicateDeploymentFlavorModelErrorBuilder(deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel(),
+ deploymentFlavorEntity.getVspId());
+ throw new CoreException(deploymentFlavorModelErrorBuilder);
+ }
+ });
+ }
- private List<String> getFeatureGroupListForVsp(String vspId, Version version) {
- final VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
- return vspDetails.getFeatureGroups();
- }
+ private List<String> getFeatureGroupListForVsp(String vspId, Version version) {
+ final VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
+ return vspDetails.getFeatureGroups();
+ }
- private boolean isEmpty(Collection coll) {
- return coll == null || coll.isEmpty();
- }
+ private boolean isEmpty(Collection coll) {
+ return coll == null || coll.isEmpty();
+ }
- private boolean validFeatureGroup(List<String> featureGroups, String featureGroupId) {
- Iterator<String> iterator = featureGroups.iterator();
- boolean valid = false;
- while (iterator.hasNext()) {
- String fgId = iterator.next().trim();
- if (fgId.equals(featureGroupId)) {
- valid = true;
- break;
- } else {
- valid = false;
- }
+ private boolean validFeatureGroup(List<String> featureGroups, String featureGroupId) {
+ Iterator<String> iterator = featureGroups.iterator();
+ boolean valid = false;
+ while (iterator.hasNext()) {
+ String fgId = iterator.next().trim();
+ if (fgId.equals(featureGroupId)) {
+ valid = true;
+ break;
+ } else {
+ valid = false;
+ }
+ }
+ return valid;
}
- return valid;
- }
- private void validateComponentComputeAssociation(DeploymentFlavorEntity deploymentFlavorEntity,
- Version version) {
- List<ComponentComputeAssociation> componentComputeAssociationList =
- deploymentFlavorEntity.getDeploymentFlavorCompositionData().getComponentComputeAssociations();
+ private void validateComponentComputeAssociation(DeploymentFlavorEntity deploymentFlavorEntity, Version version) {
+ List<ComponentComputeAssociation> componentComputeAssociationList = deploymentFlavorEntity.getDeploymentFlavorCompositionData()
+ .getComponentComputeAssociations();
List<String> vfcList = new ArrayList<>();
if (!isEmpty(componentComputeAssociationList)) {
componentComputeAssociationList.forEach(
- componentComputeAssociation -> validateComponentComputeAssocoationList(deploymentFlavorEntity,
- version,
- vfcList, componentComputeAssociation));
+ componentComputeAssociation -> validateComponentComputeAssocoationList(deploymentFlavorEntity, version, vfcList,
+ componentComputeAssociation));
Map<String, Integer> frequencyMapping = CollectionUtils.getCardinalityMap(vfcList);
-
for (Integer vfcCount : frequencyMapping.values()) {
if (vfcCount != 1) {
- ErrorCode duplicateVfcAssociationErrorBuilder =
- DeploymentFlavorErrorBuilder.getDuplicateVfcAssociationErrorBuilder();
+ ErrorCode duplicateVfcAssociationErrorBuilder = DeploymentFlavorErrorBuilder.getDuplicateVfcAssociationErrorBuilder();
throw new CoreException(duplicateVfcAssociationErrorBuilder);
}
}
}
}
- private void validateComponentComputeAssocoationList(
- DeploymentFlavorEntity deploymentFlavorEntity,
- Version version,
- List<String> vfcList,
- ComponentComputeAssociation componentComputeAssociation) {
- if ((componentComputeAssociation.getComponentId() == null || componentComputeAssociation
- .getComponentId().trim().length() == 0)
- && (componentComputeAssociation
- .getComputeFlavorId() != null && componentComputeAssociation
- .getComputeFlavorId().trim().length() > 0)) {
- ErrorCode invalidAssociationErrorBuilder = DeploymentFlavorErrorBuilder
- .getInvalidAssociationErrorBuilder();
+ private void validateComponentComputeAssocoationList(DeploymentFlavorEntity deploymentFlavorEntity, Version version, List<String> vfcList,
+ ComponentComputeAssociation componentComputeAssociation) {
+ if ((componentComputeAssociation.getComponentId() == null || componentComputeAssociation.getComponentId().trim().length() == 0) && (
+ componentComputeAssociation.getComputeFlavorId() != null && componentComputeAssociation.getComputeFlavorId().trim().length() > 0)) {
+ ErrorCode invalidAssociationErrorBuilder = DeploymentFlavorErrorBuilder.getInvalidAssociationErrorBuilder();
throw new CoreException(invalidAssociationErrorBuilder);
- } else if (componentComputeAssociation.getComponentId() != null
- && componentComputeAssociation.getComponentId().trim().length() > 0) {
- validateComponentAssociation(deploymentFlavorEntity,
- version, componentComputeAssociation);
-
- validateComponentComputeAssociationFlavour(deploymentFlavorEntity,
- version, componentComputeAssociation);
+ } else if (componentComputeAssociation.getComponentId() != null && componentComputeAssociation.getComponentId().trim().length() > 0) {
+ validateComponentAssociation(deploymentFlavorEntity, version, componentComputeAssociation);
+ validateComponentComputeAssociationFlavour(deploymentFlavorEntity, version, componentComputeAssociation);
vfcList.add(componentComputeAssociation.getComponentId());
}
}
private void validateComponentAssociation(DeploymentFlavorEntity deploymentFlavorEntity, Version version,
ComponentComputeAssociation componentComputeAssociation) {
-
if (StringUtils.isNotBlank(componentComputeAssociation.getComponentId())) {
- ComponentEntity componentEntity =
- componentDao.get(new ComponentEntity(deploymentFlavorEntity.getVspId(), version,
- componentComputeAssociation.getComponentId()));
+ ComponentEntity componentEntity = componentDao
+ .get(new ComponentEntity(deploymentFlavorEntity.getVspId(), version, componentComputeAssociation.getComponentId()));
if (componentEntity == null) {
- ErrorCode invalidComputeIdErrorBuilder =
- DeploymentFlavorErrorBuilder.getInvalidComponentIdErrorBuilder();
+ ErrorCode invalidComputeIdErrorBuilder = DeploymentFlavorErrorBuilder.getInvalidComponentIdErrorBuilder();
throw new CoreException(invalidComputeIdErrorBuilder);
}
}
}
- private void validateComponentComputeAssociationFlavour(
- DeploymentFlavorEntity deploymentFlavorEntity,
- Version version,
- ComponentComputeAssociation componentComputeAssociation) {
- if (componentComputeAssociation
- .getComputeFlavorId() != null && componentComputeAssociation
- .getComputeFlavorId().trim().length() > 0) {
- ComputeEntity computeFlavor = computeDao.get(new ComputeEntity(deploymentFlavorEntity
- .getVspId(), version, componentComputeAssociation.getComponentId(),
- componentComputeAssociation.getComputeFlavorId()));
- if (computeFlavor == null) {
- ErrorCode invalidComputeIdErrorBuilder = DeploymentFlavorErrorBuilder
- .getInvalidComputeIdErrorBuilder();
- throw new CoreException(invalidComputeIdErrorBuilder);
- }
+ private void validateComponentComputeAssociationFlavour(DeploymentFlavorEntity deploymentFlavorEntity, Version version,
+ ComponentComputeAssociation componentComputeAssociation) {
+ if (componentComputeAssociation.getComputeFlavorId() != null && componentComputeAssociation.getComputeFlavorId().trim().length() > 0) {
+ ComputeEntity computeFlavor = computeDao.get(
+ new ComputeEntity(deploymentFlavorEntity.getVspId(), version, componentComputeAssociation.getComponentId(),
+ componentComputeAssociation.getComputeFlavorId()));
+ if (computeFlavor == null) {
+ ErrorCode invalidComputeIdErrorBuilder = DeploymentFlavorErrorBuilder.getInvalidComputeIdErrorBuilder();
+ throw new CoreException(invalidComputeIdErrorBuilder);
+ }
+ }
}
- }
-
- @Override
- public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId,
- Version version,
- String deploymentFlavorId) {
- DeploymentFlavorEntity deploymentFlavorEntity =
- getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
- DeploymentFlavor deploymentFlavor = deploymentFlavorEntity.getDeploymentFlavorCompositionData();
- DeploymentFlavorCompositionSchemaInput schemaInput = new
- DeploymentFlavorCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(vspId, version));
- schemaInput.setDeploymentFlavor(deploymentFlavor);
- List<String> featureGroups =
- getFeatureGroupListForVsp(vspId, version);
- schemaInput.setFeatureGroupIds(featureGroups);
- CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
- response.setId(deploymentFlavorId);
- response.setSchema(SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.deployment,
- schemaInput));
- response.setData(deploymentFlavor);
- return response;
- }
-
- private DeploymentFlavorEntity getValidatedDeploymentFlavor(String vspId, Version version, String
- deploymentFlavorId) {
- DeploymentFlavorEntity retrieved = deploymentFlavorDao.get(new DeploymentFlavorEntity(vspId,
- version, deploymentFlavorId));
- VersioningUtil
- .validateEntityExistence(retrieved, new DeploymentFlavorEntity(vspId, version,
- deploymentFlavorId), VspDetails.ENTITY_TYPE);
- return retrieved;
- }
- @Override
- public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId,
- Version version) {
- DeploymentFlavorCompositionSchemaInput schemaInput =
- new DeploymentFlavorCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(vspId, version));
- List<String> featureGroups =
- getFeatureGroupListForVsp(vspId, version);
- schemaInput.setFeatureGroupIds(featureGroups);
- CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
- response.setSchema(SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.deployment,
- schemaInput));
- return response;
- }
-
- @Override
- public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
- DeploymentFlavorEntity deploymentFlavorEntity =
- getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
- if (!vspInfoDao.isManual(vspId, version)) {
- final ErrorCode deleteDeploymentFlavorErrorBuilder =
- NotSupportedHeatOnboardMethodErrorBuilder
- .getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder();
- throw new CoreException(deleteDeploymentFlavorErrorBuilder);
+ @Override
+ public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
+ DeploymentFlavorEntity deploymentFlavorEntity = getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
+ DeploymentFlavor deploymentFlavor = deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+ DeploymentFlavorCompositionSchemaInput schemaInput = new DeploymentFlavorCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+ schemaInput.setDeploymentFlavor(deploymentFlavor);
+ List<String> featureGroups = getFeatureGroupListForVsp(vspId, version);
+ schemaInput.setFeatureGroupIds(featureGroups);
+ CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
+ response.setId(deploymentFlavorId);
+ response.setSchema(SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.deployment, schemaInput));
+ response.setData(deploymentFlavor);
+ return response;
}
- if (deploymentFlavorEntity != null) {
- deploymentFlavorDao.delete(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
+ private DeploymentFlavorEntity getValidatedDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
+ DeploymentFlavorEntity retrieved = deploymentFlavorDao.get(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
+ VersioningUtil.validateEntityExistence(retrieved, new DeploymentFlavorEntity(vspId, version, deploymentFlavorId), VspDetails.ENTITY_TYPE);
+ return retrieved;
}
- }
- @Override
- public CompositionEntityValidationData updateDeploymentFlavor(
- DeploymentFlavorEntity deploymentFlavorEntity) {
- if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
- deploymentFlavorEntity.getVersion())) {
- final ErrorCode updateDeploymentFlavorErrorBuilder =
- NotSupportedHeatOnboardMethodErrorBuilder
- .getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder();
- throw new CoreException(updateDeploymentFlavorErrorBuilder);
+ @Override
+ public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId, Version version) {
+ DeploymentFlavorCompositionSchemaInput schemaInput = new DeploymentFlavorCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+ List<String> featureGroups = getFeatureGroupListForVsp(vspId, version);
+ schemaInput.setFeatureGroupIds(featureGroups);
+ CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
+ response.setSchema(SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.deployment, schemaInput));
+ return response;
}
- DeploymentFlavorEntity retrieved =
- getValidatedDeploymentFlavor(deploymentFlavorEntity.getVspId(),
- deploymentFlavorEntity.getVersion(),
- deploymentFlavorEntity.getId());
-
-
- Collection<DeploymentFlavorEntity> listDeploymentFlavors = listDeploymentFlavors(
- deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion());
- listDeploymentFlavors.remove(retrieved);
- isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
- validateComponentComputeAssociation(deploymentFlavorEntity,
- deploymentFlavorEntity.getVersion());
-
- DeploymentFlavorCompositionSchemaInput schemaInput = new
- DeploymentFlavorCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
- deploymentFlavorEntity.getVersion()));
- schemaInput.setDeploymentFlavor(retrieved.getDeploymentFlavorCompositionData());
+ @Override
+ public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
+ DeploymentFlavorEntity deploymentFlavorEntity = getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
+ if (!vspInfoDao.isManual(vspId, version)) {
+ final ErrorCode deleteDeploymentFlavorErrorBuilder = NotSupportedHeatOnboardMethodErrorBuilder
+ .getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder();
+ throw new CoreException(deleteDeploymentFlavorErrorBuilder);
+ }
+ if (deploymentFlavorEntity != null) {
+ deploymentFlavorDao.delete(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
+ }
+ }
- List<String> featureGroups =
- getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(),
+ @Override
+ public CompositionEntityValidationData updateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity) {
+ if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion())) {
+ final ErrorCode updateDeploymentFlavorErrorBuilder = NotSupportedHeatOnboardMethodErrorBuilder
+ .getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder();
+ throw new CoreException(updateDeploymentFlavorErrorBuilder);
+ }
+ DeploymentFlavorEntity retrieved = getValidatedDeploymentFlavor(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion(),
+ deploymentFlavorEntity.getId());
+ Collection<DeploymentFlavorEntity> listDeploymentFlavors = listDeploymentFlavors(deploymentFlavorEntity.getVspId(),
deploymentFlavorEntity.getVersion());
- schemaInput.setFeatureGroupIds(featureGroups);
-
- CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(deploymentFlavorEntity, SchemaTemplateContext.composition, schemaInput);
- if (CollectionUtils.isEmpty(validationData.getErrors())) {
- deploymentFlavorDao.update(deploymentFlavorEntity);
+ listDeploymentFlavors.remove(retrieved);
+ isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
+ validateComponentComputeAssociation(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
+ DeploymentFlavorCompositionSchemaInput schemaInput = new DeploymentFlavorCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion()));
+ schemaInput.setDeploymentFlavor(retrieved.getDeploymentFlavorCompositionData());
+ List<String> featureGroups = getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion());
+ schemaInput.setFeatureGroupIds(featureGroups);
+ CompositionEntityValidationData validationData = compositionEntityDataManager
+ .validateEntity(deploymentFlavorEntity, SchemaTemplateContext.composition, schemaInput);
+ if (CollectionUtils.isEmpty(validationData.getErrors())) {
+ deploymentFlavorDao.update(deploymentFlavorEntity);
+ }
+ return validationData;
}
- return validationData;
- }
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java
index 5972d49614..061e344a92 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.ImageManager;
import org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory;
@@ -29,16 +27,11 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoF
public class ImageManagerFactoryImpl extends ImageManagerFactory {
- private static final ImageManager INSTANCE =
- new ImageManagerImpl(
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- ImageDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface()
- );
-
- @Override
- public ImageManager createInterface() {
- return INSTANCE;
- }
+ private static final ImageManager INSTANCE = new ImageManagerImpl(VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
+ ImageDaoFactory.getInstance().createInterface(), CompositionEntityDataManagerFactory.getInstance().createInterface());
+ @Override
+ public ImageManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
index 1e547d33ce..c4245d742d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-
+import java.util.Collection;
+import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.common.errors.CoreException;
@@ -44,215 +44,166 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-import java.util.stream.Collectors;
-
public class ImageManagerImpl implements ImageManager {
- private final VendorSoftwareProductInfoDao vspInfoDao;
- private final ImageDao imageDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- public ImageManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
- ImageDao imageDao,
- CompositionEntityDataManager compositionEntityDataManager) {
- this.vspInfoDao = vspInfoDao;
- this.imageDao = imageDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- }
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+ private final ImageDao imageDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
- @Override
- public ImageEntity createImage(ImageEntity imageEntity) {
- boolean isManual = vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion());
- if (!isManual) {
- ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder
- .getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
- throw new CoreException(errorCode);
+ public ImageManagerImpl(VendorSoftwareProductInfoDao vspInfoDao, ImageDao imageDao, CompositionEntityDataManager compositionEntityDataManager) {
+ this.vspInfoDao = vspInfoDao;
+ this.imageDao = imageDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
}
- compositionEntityDataManager.createImage(imageEntity);
- return imageEntity;
- }
-
- @Override
- public Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
- return imageDao.list(new ImageEntity(vspId, version, componentId, null));
- }
-
- @Override
- public CompositionEntityResponse<Image> getImageSchema(String vspId) {
- CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
- ImageCompositionSchemaInput inputSchema = new ImageCompositionSchemaInput();
- Image image = new Image();
- inputSchema.setImage(image);
- response.setSchema(getImageCompositionSchema(inputSchema));
- return response;
- }
- @Override
- public CompositionEntityResponse<Image> getImage(String vspId, Version version, String
- componentId, String imageId) {
- ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
-
- Image image = imageEntity.getImageCompositionData();
-
- ImageCompositionSchemaInput schemaInput = new ImageCompositionSchemaInput();
- schemaInput.setImage(image);
-
- CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
- response.setId(imageId);
- response.setData(image);
- response.setSchema(getImageCompositionSchema(schemaInput));
- return response;
- }
-
- @Override
- public QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String
- componentId, String imageId) {
- QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
-
- ImageEntity retrieved = imageDao.getQuestionnaireData(vspId, version, componentId, imageId);
- VersioningUtil.validateEntityExistence(retrieved, new ImageEntity(vspId, version, componentId,
- imageId), ComponentEntity.ENTITY_TYPE);
- questionnaireResponse.setData(retrieved.getQuestionnaireData());
- questionnaireResponse.setSchema(getImageQuestionnaireSchema(null));
- return questionnaireResponse;
- }
-
- @Override
- public void deleteImage(String vspId, Version version, String componentId, String imageId) {
- ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
- if (!vspInfoDao.isManual(vspId, version)) {
- final ErrorCode deleteImageErrorBuilder =
- NotSupportedHeatOnboardMethodErrorBuilder
- .getDelImageNotSupportedHeatOnboardMethodErrorBuilder();
- throw new CoreException(deleteImageErrorBuilder);
+ @Override
+ public ImageEntity createImage(ImageEntity imageEntity) {
+ boolean isManual = vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion());
+ if (!isManual) {
+ ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder.getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
+ throw new CoreException(errorCode);
+ }
+ compositionEntityDataManager.createImage(imageEntity);
+ return imageEntity;
}
- if (imageEntity != null) {
- imageDao.delete(new ImageEntity(vspId, version, componentId, imageId));
- }
- }
- private void validateHeatVspImageUpdate(String name, String value, String retrievedValue) {
- if (value != null && !value.equals(retrievedValue)) {
- final ErrorCode updateHeatImageErrorBuilder =
- ImageErrorBuilder.getImageHeatReadOnlyErrorBuilder(name);
- throw new CoreException(updateHeatImageErrorBuilder);
+ @Override
+ public Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
+ return imageDao.list(new ImageEntity(vspId, version, componentId, null));
}
- }
-
- @Override
- public CompositionEntityValidationData updateImage(ImageEntity image) {
- boolean isManual = vspInfoDao.isManual(image.getVspId(), image.getVersion());
- ImageEntity retrieved =
- getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(),
- image.getId());
- Collection<ImageEntity> vfcImageList = listImages(image.getVspId(),
- image.getVersion(), image.getComponentId());
-
- //Set to null so that retrieved object is equal to one in list and gets removed.
- retrieved.setQuestionnaireData(null);
- vfcImageList.remove(retrieved);
-
-
- ImageCompositionSchemaInput schemaInput = new ImageCompositionSchemaInput();
- schemaInput.setManual(isManual);
- schemaInput.setImage(retrieved.getImageCompositionData());
-
- CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(image, SchemaTemplateContext.composition, schemaInput);
- if (CollectionUtils.isEmpty(validationData.getErrors())) {
- imageDao.update(image);
+ @Override
+ public CompositionEntityResponse<Image> getImageSchema(String vspId) {
+ CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
+ ImageCompositionSchemaInput inputSchema = new ImageCompositionSchemaInput();
+ Image image = new Image();
+ inputSchema.setImage(image);
+ response.setSchema(getImageCompositionSchema(inputSchema));
+ return response;
}
- return validationData;
- }
- @Override
- public void updateImageQuestionnaire(String vspId, Version version, String componentId, String
- imageId, String questionnaireData) {
- getImageEntity(vspId, version, componentId, imageId);
-
-
- final ImageDetails image = JsonUtil.json2Object(questionnaireData, ImageDetails.class);
- final String format = image.getFormat();
- try {
- if (format != null) {
- ImageFormat.valueOf(format);
- }
- } catch (IllegalArgumentException exception) {
- ErrorCode errorCode = ImageErrorBuilder.getInvalidImageFormatErrorBuilder();
- throw new CoreException(errorCode, exception);
+ @Override
+ public CompositionEntityResponse<Image> getImage(String vspId, Version version, String componentId, String imageId) {
+ ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
+ Image image = imageEntity.getImageCompositionData();
+ ImageCompositionSchemaInput schemaInput = new ImageCompositionSchemaInput();
+ schemaInput.setImage(image);
+ CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
+ response.setId(imageId);
+ response.setData(image);
+ response.setSchema(getImageCompositionSchema(schemaInput));
+ return response;
}
- //Validate Format is read only for HEAT Onboarding
- if (!vspInfoDao.isManual(vspId, version)) {
- final QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version,
- componentId, imageId);
- final String data = imageQuestionnaire.getData();
- if (data != null) {
- String retrievedFormat = JsonUtil.json2Object(data, ImageDetails.class).getFormat();
- validateHeatVspImageUpdate("format", format, retrievedFormat);
- }
+ @Override
+ public QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String componentId, String imageId) {
+ QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
+ ImageEntity retrieved = imageDao.getQuestionnaireData(vspId, version, componentId, imageId);
+ VersioningUtil.validateEntityExistence(retrieved, new ImageEntity(vspId, version, componentId, imageId), ComponentEntity.ENTITY_TYPE);
+ questionnaireResponse.setData(retrieved.getQuestionnaireData());
+ questionnaireResponse.setSchema(getImageQuestionnaireSchema(null));
+ return questionnaireResponse;
}
- if (!isImageVersionUnique(vspId, version, componentId, imageId, image)) {
- ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageVersionErrorBuilder(image
- .getVersion(), componentId);
- throw new CoreException(errorCode);
+ @Override
+ public void deleteImage(String vspId, Version version, String componentId, String imageId) {
+ ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
+ if (!vspInfoDao.isManual(vspId, version)) {
+ final ErrorCode deleteImageErrorBuilder = NotSupportedHeatOnboardMethodErrorBuilder
+ .getDelImageNotSupportedHeatOnboardMethodErrorBuilder();
+ throw new CoreException(deleteImageErrorBuilder);
+ }
+ if (imageEntity != null) {
+ imageDao.delete(new ImageEntity(vspId, version, componentId, imageId));
+ }
}
- imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData);
- }
-
- private boolean isImageVersionUnique(String vspId, Version version, String componentId,
- String imageId,
- ImageDetails image) {
- boolean isPresent = true;
- if (image != null && image.getVersion() != null) {
- Collection<ImageEntity> imageEntities =
- imageDao.list(new ImageEntity(vspId, version, componentId, null));
- if (CollectionUtils.isNotEmpty(imageEntities)) {
- imageEntities =
- imageEntities.stream().filter(imageEntity -> image.getVersion().trim().equalsIgnoreCase(
- getImageVersion(vspId, version, componentId, imageEntity))
- && !imageEntity.getId().equals(imageId)).collect(Collectors.toList());
-
- isPresent = CollectionUtils.isEmpty(imageEntities);
- }
+ private void validateHeatVspImageUpdate(String name, String value, String retrievedValue) {
+ if (value != null && !value.equals(retrievedValue)) {
+ final ErrorCode updateHeatImageErrorBuilder = ImageErrorBuilder.getImageHeatReadOnlyErrorBuilder(name);
+ throw new CoreException(updateHeatImageErrorBuilder);
+ }
}
- return isPresent;
- }
-
- private String getImageVersion(String vspId, Version version, String componentId,
- ImageEntity imageEntity) {
- QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version,
- componentId, imageEntity.getId());
- ImageDetails imageDetails =
- JsonUtil.json2Object(imageQuestionnaire.getData(), ImageDetails.class);
+ @Override
+ public CompositionEntityValidationData updateImage(ImageEntity image) {
+ boolean isManual = vspInfoDao.isManual(image.getVspId(), image.getVersion());
+ ImageEntity retrieved = getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(), image.getId());
+ Collection<ImageEntity> vfcImageList = listImages(image.getVspId(), image.getVersion(), image.getComponentId());
+ //Set to null so that retrieved object is equal to one in list and gets removed.
+ retrieved.setQuestionnaireData(null);
+ vfcImageList.remove(retrieved);
+ ImageCompositionSchemaInput schemaInput = new ImageCompositionSchemaInput();
+ schemaInput.setManual(isManual);
+ schemaInput.setImage(retrieved.getImageCompositionData());
+ CompositionEntityValidationData validationData = compositionEntityDataManager
+ .validateEntity(image, SchemaTemplateContext.composition, schemaInput);
+ if (CollectionUtils.isEmpty(validationData.getErrors())) {
+ imageDao.update(image);
+ }
+ return validationData;
+ }
- return imageDetails == null ? null
- : imageDetails.getVersion() != null ? imageDetails.getVersion().trim() : null;
- }
+ @Override
+ public void updateImageQuestionnaire(String vspId, Version version, String componentId, String imageId, String questionnaireData) {
+ getImageEntity(vspId, version, componentId, imageId);
+ final ImageDetails image = JsonUtil.json2Object(questionnaireData, ImageDetails.class);
+ final String format = image.getFormat();
+ try {
+ if (format != null) {
+ ImageFormat.valueOf(format);
+ }
+ } catch (IllegalArgumentException exception) {
+ ErrorCode errorCode = ImageErrorBuilder.getInvalidImageFormatErrorBuilder();
+ throw new CoreException(errorCode, exception);
+ }
+ //Validate Format is read only for HEAT Onboarding
+ if (!vspInfoDao.isManual(vspId, version)) {
+ final QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version, componentId, imageId);
+ final String data = imageQuestionnaire.getData();
+ if (data != null) {
+ String retrievedFormat = JsonUtil.json2Object(data, ImageDetails.class).getFormat();
+ validateHeatVspImageUpdate("format", format, retrievedFormat);
+ }
+ }
+ if (!isImageVersionUnique(vspId, version, componentId, imageId, image)) {
+ ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageVersionErrorBuilder(image.getVersion(), componentId);
+ throw new CoreException(errorCode);
+ }
+ imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData);
+ }
- private ImageEntity getImageEntity(String vspId, Version version, String componentId,
- String imageId) {
+ private boolean isImageVersionUnique(String vspId, Version version, String componentId, String imageId, ImageDetails image) {
+ boolean isPresent = true;
+ if (image != null && image.getVersion() != null) {
+ Collection<ImageEntity> imageEntities = imageDao.list(new ImageEntity(vspId, version, componentId, null));
+ if (CollectionUtils.isNotEmpty(imageEntities)) {
+ imageEntities = imageEntities.stream().filter(
+ imageEntity -> image.getVersion().trim().equalsIgnoreCase(getImageVersion(vspId, version, componentId, imageEntity))
+ && !imageEntity.getId().equals(imageId)).collect(Collectors.toList());
+ isPresent = CollectionUtils.isEmpty(imageEntities);
+ }
+ }
+ return isPresent;
+ }
- ImageEntity imageEntity = imageDao.get(new ImageEntity(vspId, version, componentId, imageId));
+ private String getImageVersion(String vspId, Version version, String componentId, ImageEntity imageEntity) {
+ QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version, componentId, imageEntity.getId());
+ ImageDetails imageDetails = JsonUtil.json2Object(imageQuestionnaire.getData(), ImageDetails.class);
+ return imageDetails == null ? null : imageDetails.getVersion() != null ? imageDetails.getVersion().trim() : null;
+ }
- VersioningUtil.validateEntityExistence(imageEntity, new ImageEntity(vspId, version, componentId,
- imageId), VspDetails.ENTITY_TYPE);
- return imageEntity;
- }
+ private ImageEntity getImageEntity(String vspId, Version version, String componentId, String imageId) {
+ ImageEntity imageEntity = imageDao.get(new ImageEntity(vspId, version, componentId, imageId));
+ VersioningUtil.validateEntityExistence(imageEntity, new ImageEntity(vspId, version, componentId, imageId), VspDetails.ENTITY_TYPE);
+ return imageEntity;
+ }
- protected String getImageCompositionSchema(SchemaTemplateInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.image,
- schemaInput);
- }
+ protected String getImageCompositionSchema(SchemaTemplateInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.image, schemaInput);
+ }
- protected String getImageQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image,
- schemaInput);
- }
+ protected String getImageQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image, schemaInput);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
index 58cb2cf2d6..e7697aad35 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService;
import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
@@ -29,84 +31,73 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionS
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(ManualVspToscaManagerImpl.class);
-
- private final ManualVspDataCollectionService
- manualVspDataCollectionService = new ManualVspDataCollectionService();
-
- @Override
- public VspModelInfo gatherVspInformation(String vspId, Version version) {
- VspModelInfo vspModelInfo = new VspModelInfo();
- //Get Release Vendor Name
- Optional<String> releaseVendor;
- try {
- releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version);
- } catch (Exception ex) {
- releaseVendor = Optional.empty();
- LOGGER.error("Failed to get release vendor: {}", ex.getMessage(), ex);
- }
- releaseVendor.ifPresent(vspModelInfo::setReleaseVendor);
-
- //Get Allowed Deployment flavors information
- Map<String, DeploymentFlavorModel> allowedFlavors;
- try {
- allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version);
- } catch (Exception ex) {
- allowedFlavors = null;
- LOGGER.error("Failed to get allowed flavours: {}", ex.getMessage(), ex);
- }
- if (MapUtils.isNotEmpty(allowedFlavors)) {
- vspModelInfo.setAllowedFlavors(allowedFlavors);
- }
-
- //Get VFC Image information
- Map<String, List<MultiFlavorVfcImage>> vspComponentImages;
- try {
- vspComponentImages =
- manualVspDataCollectionService.getVspComponentImages(vspId, version);
- } catch (Exception ex) {
- vspComponentImages = null;
- LOGGER.error("Failed to get VSP components Images: {}", ex.getMessage(), ex);
- }
- if (MapUtils.isNotEmpty(vspComponentImages)) {
- vspModelInfo.setMultiFlavorVfcImages(vspComponentImages);
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(ManualVspToscaManagerImpl.class);
+ private final ManualVspDataCollectionService manualVspDataCollectionService = new ManualVspDataCollectionService();
- //Get VFC component information
- Map<String, String> vspComponents;
- try {
- vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version);
- } catch (Exception ex) {
- vspComponents = null;
- LOGGER.error("Failed to get VSP components: {}", ex.getMessage(), ex);
- }
- if (MapUtils.isNotEmpty(vspComponents)) {
- vspModelInfo.setComponents(vspComponents);
+ @Override
+ public VspModelInfo gatherVspInformation(String vspId, Version version) {
+ VspModelInfo vspModelInfo = new VspModelInfo();
+ //Get Release Vendor Name
+ Optional<String> releaseVendor;
+ try {
+ releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version);
+ } catch (Exception ex) {
+ releaseVendor = Optional.empty();
+ LOGGER.error("Failed to get release vendor: {}", ex.getMessage(), ex);
+ }
+ releaseVendor.ifPresent(vspModelInfo::setReleaseVendor);
+ //Get Allowed Deployment flavors information
+ Map<String, DeploymentFlavorModel> allowedFlavors;
+ try {
+ allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version);
+ } catch (Exception ex) {
+ allowedFlavors = null;
+ LOGGER.error("Failed to get allowed flavours: {}", ex.getMessage(), ex);
+ }
+ if (MapUtils.isNotEmpty(allowedFlavors)) {
+ vspModelInfo.setAllowedFlavors(allowedFlavors);
+ }
+ //Get VFC Image information
+ Map<String, List<MultiFlavorVfcImage>> vspComponentImages;
+ try {
+ vspComponentImages = manualVspDataCollectionService.getVspComponentImages(vspId, version);
+ } catch (Exception ex) {
+ vspComponentImages = null;
+ LOGGER.error("Failed to get VSP components Images: {}", ex.getMessage(), ex);
+ }
+ if (MapUtils.isNotEmpty(vspComponentImages)) {
+ vspModelInfo.setMultiFlavorVfcImages(vspComponentImages);
+ }
+ //Get VFC component information
+ Map<String, String> vspComponents;
+ try {
+ vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version);
+ } catch (Exception ex) {
+ vspComponents = null;
+ LOGGER.error("Failed to get VSP components: {}", ex.getMessage(), ex);
+ }
+ if (MapUtils.isNotEmpty(vspComponents)) {
+ vspModelInfo.setComponents(vspComponents);
+ }
+ //Get VSP component nic information
+ Map<String, List<Nic>> vspComponentNics;
+ try {
+ vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version);
+ } catch (Exception ex) {
+ vspComponentNics = null;
+ LOGGER.error("Failed to get VSP component NIC data: {}", ex.getMessage(), ex);
+ }
+ if (MapUtils.isNotEmpty(vspComponentNics)) {
+ vspModelInfo.setNics(vspComponentNics);
+ }
+ return vspModelInfo;
}
- //Get VSP component nic information
- Map<String, List<Nic>> vspComponentNics;
- try {
- vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version);
- } catch (Exception ex) {
- vspComponentNics = null;
- LOGGER.error("Failed to get VSP component NIC data: {}", ex.getMessage(), ex);
+ @Override
+ public ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo) {
+ ManualVspToscaGenerationService vspToscaGenerator = new ManualVspToscaGenerationService();
+ return vspToscaGenerator.createManualVspToscaServiceModel(vspModelInfo);
}
- if (MapUtils.isNotEmpty(vspComponentNics)) {
- vspModelInfo.setNics(vspComponentNics);
- }
- return vspModelInfo;
- }
-
- @Override
- public ToscaServiceModel generateToscaModel(VspModelInfo vspModelInfo) {
- ManualVspToscaGenerationService vspToscaGenerator = new ManualVspToscaGenerationService();
- return vspToscaGenerator.createManualVspToscaServiceModel(vspModelInfo);
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java
index eed566de43..123de3dbd5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
@@ -25,11 +24,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
public class MonitoringUploadsManagerFactoryImpl extends MonitoringUploadsManagerFactory {
- private static final MonitoringUploadsManager INSTANCE =
- new MonitoringUploadsManagerImpl(MonitoringUploadDaoFactory.getInstance().createInterface());
- @Override
- public MonitoringUploadsManager createInterface() {
- return INSTANCE;
- }
+ private static final MonitoringUploadsManager INSTANCE = new MonitoringUploadsManagerImpl(
+ MonitoringUploadDaoFactory.getInstance().createInterface());
+
+ @Override
+ public MonitoringUploadsManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
index 03ca76fd21..c4fed30e8e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
@@ -13,9 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.core.utilities.CommonMethods;
@@ -39,171 +49,117 @@ import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-
public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
- private final ComponentArtifactDao componentArtifactDao;
-
- MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao) {
- this.componentArtifactDao = componentArtifactDao;
+ private final ComponentArtifactDao componentArtifactDao;
- componentArtifactDao.registerVersioning(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
- }
-
- @Override
- public void delete(String vspId, Version version, String componentId,
- MonitoringUploadType monitoringUploadType) {
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity =
- setValuesForComponentArtifactEntityUpload(vspId, version, null, componentId, null,
- monitoringUploadType, null);
- Optional<ComponentMonitoringUploadEntity> retrieved = componentArtifactDao.getByType(
- componentMonitoringUploadEntity);
-
- if (!retrieved.isPresent()) {
- throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
- componentMonitoringUploadEntity.getEntityType(),
- monitoringUploadType.name(),
- VspDetails.ENTITY_TYPE,
- componentMonitoringUploadEntity.getFirstClassCitizenId(),
- version).build());
+ MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao) {
+ this.componentArtifactDao = componentArtifactDao;
+ componentArtifactDao.registerVersioning(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
}
- componentArtifactDao.delete(retrieved.get());
- }
-
- @Override
- public void upload(InputStream object, String filename, String vspId,
- Version version, String componentId,
- MonitoringUploadType type) {
- if (object == null) {
- throw new CoreException(new MonitoringUploadErrorBuilder(
- getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
- "zip")).build());
- } else {
- Map<String, List<ErrorMessage>> errors = new HashMap<>();
- try {
- byte[] uploadedFileData = FileUtils.toByteArray(object);
- final FileContentHandler upload =
- validateZip(vspId, version, uploadedFileData, errors);
- if (type.equals(MonitoringUploadType.VES_EVENTS)) {
- validateVesEventUpload(upload, errors);
- }
- if (MapUtils.isNotEmpty(errors)) {
- throw new CoreException(
- new MonitoringUploadErrorBuilder(
- errors.values().iterator().next().get(0).getMessage())
- .build());
+ @Override
+ public void delete(String vspId, Version version, String componentId, MonitoringUploadType monitoringUploadType) {
+ ComponentMonitoringUploadEntity componentMonitoringUploadEntity = setValuesForComponentArtifactEntityUpload(vspId, version, null, componentId,
+ null, monitoringUploadType, null);
+ Optional<ComponentMonitoringUploadEntity> retrieved = componentArtifactDao.getByType(componentMonitoringUploadEntity);
+ if (!retrieved.isPresent()) {
+ throw new CoreException(
+ new VersionableSubEntityNotFoundErrorBuilder(componentMonitoringUploadEntity.getEntityType(), monitoringUploadType.name(),
+ VspDetails.ENTITY_TYPE, componentMonitoringUploadEntity.getFirstClassCitizenId(), version).build());
}
-
- createArtifactInDatabase(vspId, version, filename, componentId, type,
- uploadedFileData);
-
- } catch (Exception exception) {
- throw new CoreException(new MonitoringUploadErrorBuilder(exception.getMessage()).build());
- }
+ componentArtifactDao.delete(retrieved.get());
}
- }
- private void validateVesEventUpload(FileContentHandler upload,
- Map<String, List<ErrorMessage>> errors) {
- if (!CommonUtil.validateAllFilesYml(upload)) {
- ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
- .add(new ErrorMessage(ErrorLevel.ERROR,
- Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage()));
- throw new CoreException(
- new MonitoringUploadErrorBuilder(
- Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage())
- .build());
+ @Override
+ public void upload(InputStream object, String filename, String vspId, Version version, String componentId, MonitoringUploadType type) {
+ if (object == null) {
+ throw new CoreException(
+ new MonitoringUploadErrorBuilder(getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(), "zip"))
+ .build());
+ } else {
+ Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ try {
+ byte[] uploadedFileData = FileUtils.toByteArray(object);
+ final FileContentHandler upload = validateZip(vspId, version, uploadedFileData, errors);
+ if (type.equals(MonitoringUploadType.VES_EVENTS)) {
+ validateVesEventUpload(upload, errors);
+ }
+ if (MapUtils.isNotEmpty(errors)) {
+ throw new CoreException(new MonitoringUploadErrorBuilder(errors.values().iterator().next().get(0).getMessage()).build());
+ }
+ createArtifactInDatabase(vspId, version, filename, componentId, type, uploadedFileData);
+ } catch (Exception exception) {
+ throw new CoreException(new MonitoringUploadErrorBuilder(exception.getMessage()).build());
+ }
+ }
}
- }
-
- private void createArtifactInDatabase(String vspId, Version version, String filename,
- String componentId,
- MonitoringUploadType type,
- byte[] uploadedFileData) {
- String artifactId = CommonMethods.nextUuId();
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity =
- setValuesForComponentArtifactEntityUpload(vspId, version, filename, componentId,
- artifactId, type, uploadedFileData);
- componentArtifactDao.create(componentMonitoringUploadEntity);
- }
-
- @Override
- public MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId) {
- ComponentMonitoringUploadEntity current =
- new ComponentMonitoringUploadEntity(vspId, version, componentId, null);
- return setMonitoringUploadStatusValues(current);
- }
-
- private MonitoringUploadStatus setMonitoringUploadStatusValues(
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- MonitoringUploadStatus monitoringUploadStatus = new MonitoringUploadStatus();
-
- Collection<ComponentMonitoringUploadEntity> artifactNames =
- componentArtifactDao.list(componentMonitoringUploadEntity);
- Map<MonitoringUploadType, String> artifactTypeToFilename =
- VendorSoftwareProductUtils.mapArtifactsByType(artifactNames);
-
- if (MapUtils.isNotEmpty(artifactTypeToFilename)) {
- if (artifactTypeToFilename.containsKey(MonitoringUploadType.SNMP_TRAP)) {
- monitoringUploadStatus
- .setSnmpTrap(artifactTypeToFilename.get(MonitoringUploadType.SNMP_TRAP));
- }
- if (artifactTypeToFilename.containsKey(MonitoringUploadType.SNMP_POLL)) {
- monitoringUploadStatus
- .setSnmpPoll(artifactTypeToFilename.get(MonitoringUploadType.SNMP_POLL));
- }
- if (artifactTypeToFilename.containsKey(MonitoringUploadType.VES_EVENTS)) {
- monitoringUploadStatus
- .setVesEvent(artifactTypeToFilename.get(MonitoringUploadType.VES_EVENTS));
- }
+ private void validateVesEventUpload(FileContentHandler upload, Map<String, List<ErrorMessage>> errors) {
+ if (!CommonUtil.validateAllFilesYml(upload)) {
+ ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
+ .add(new ErrorMessage(ErrorLevel.ERROR, Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage()));
+ throw new CoreException(new MonitoringUploadErrorBuilder(Messages.VES_ZIP_SHOULD_CONTAIN_YML_ONLY.getErrorMessage()).build());
+ }
}
- return monitoringUploadStatus;
- }
-
- private ComponentMonitoringUploadEntity setValuesForComponentArtifactEntityUpload(
- String vspId, Version version, String filename, String componentId, String artifactId,
- MonitoringUploadType monitoringUploadType, byte[] uploadedFileData) {
-
- ComponentMonitoringUploadEntity
- entity = new ComponentMonitoringUploadEntity();
+ private void createArtifactInDatabase(String vspId, Version version, String filename, String componentId, MonitoringUploadType type,
+ byte[] uploadedFileData) {
+ String artifactId = CommonMethods.nextUuId();
+ ComponentMonitoringUploadEntity componentMonitoringUploadEntity = setValuesForComponentArtifactEntityUpload(vspId, version, filename,
+ componentId, artifactId, type, uploadedFileData);
+ componentArtifactDao.create(componentMonitoringUploadEntity);
+ }
- entity.setVspId(vspId);
- entity.setVersion(version);
- entity.setComponentId(componentId);
- entity.setId(artifactId);
- entity.setType(monitoringUploadType);
- entity.setArtifactName(filename);
+ @Override
+ public MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId) {
+ ComponentMonitoringUploadEntity current = new ComponentMonitoringUploadEntity(vspId, version, componentId, null);
+ return setMonitoringUploadStatusValues(current);
+ }
- if (Objects.nonNull(uploadedFileData)) {
- entity.setArtifact(ByteBuffer.wrap(uploadedFileData));
+ private MonitoringUploadStatus setMonitoringUploadStatusValues(ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
+ MonitoringUploadStatus monitoringUploadStatus = new MonitoringUploadStatus();
+ Collection<ComponentMonitoringUploadEntity> artifactNames = componentArtifactDao.list(componentMonitoringUploadEntity);
+ Map<MonitoringUploadType, String> artifactTypeToFilename = VendorSoftwareProductUtils.mapArtifactsByType(artifactNames);
+ if (MapUtils.isNotEmpty(artifactTypeToFilename)) {
+ if (artifactTypeToFilename.containsKey(MonitoringUploadType.SNMP_TRAP)) {
+ monitoringUploadStatus.setSnmpTrap(artifactTypeToFilename.get(MonitoringUploadType.SNMP_TRAP));
+ }
+ if (artifactTypeToFilename.containsKey(MonitoringUploadType.SNMP_POLL)) {
+ monitoringUploadStatus.setSnmpPoll(artifactTypeToFilename.get(MonitoringUploadType.SNMP_POLL));
+ }
+ if (artifactTypeToFilename.containsKey(MonitoringUploadType.VES_EVENTS)) {
+ monitoringUploadStatus.setVesEvent(artifactTypeToFilename.get(MonitoringUploadType.VES_EVENTS));
+ }
+ }
+ return monitoringUploadStatus;
}
- return entity;
- }
+ private ComponentMonitoringUploadEntity setValuesForComponentArtifactEntityUpload(String vspId, Version version, String filename,
+ String componentId, String artifactId,
+ MonitoringUploadType monitoringUploadType,
+ byte[] uploadedFileData) {
+ ComponentMonitoringUploadEntity entity = new ComponentMonitoringUploadEntity();
+ entity.setVspId(vspId);
+ entity.setVersion(version);
+ entity.setComponentId(componentId);
+ entity.setId(artifactId);
+ entity.setType(monitoringUploadType);
+ entity.setArtifactName(filename);
+ if (Objects.nonNull(uploadedFileData)) {
+ entity.setArtifact(ByteBuffer.wrap(uploadedFileData));
+ }
+ return entity;
+ }
- private FileContentHandler validateZip(String vspId, Version version, byte[] uploadedFileData,
- Map<String, List<ErrorMessage>> errors) {
- FileContentHandler contentMap;
- try {
- contentMap =
- CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData);
- VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
- } catch (IOException exception) {
- throw new CoreException(
- new MonitoringUploadErrorBuilder(vspId, version,
- Messages.INVALID_ZIP_FILE.getErrorMessage())
- .build());
+ private FileContentHandler validateZip(String vspId, Version version, byte[] uploadedFileData, Map<String, List<ErrorMessage>> errors) {
+ FileContentHandler contentMap;
+ try {
+ contentMap = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData);
+ VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
+ } catch (IOException exception) {
+ throw new CoreException(new MonitoringUploadErrorBuilder(vspId, version, Messages.INVALID_ZIP_FILE.getErrorMessage()).build());
+ }
+ return contentMap;
}
- return contentMap;
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java
index 77501db298..83676a79e7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
@@ -27,14 +26,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
public class NetworkManagerFactoryImpl extends NetworkManagerFactory {
- private static final NetworkManager INSTANCE =
- new NetworkManagerImpl(
- NetworkDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
- @Override
- public NetworkManager createInterface() {
- return INSTANCE;
- }
+ private static final NetworkManager INSTANCE = new NetworkManagerImpl(NetworkDaoFactory.getInstance().createInterface(),
+ CompositionEntityDataManagerFactory.getInstance().createInterface(), VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
+
+ @Override
+ public NetworkManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
index 3d278d6934..7f50526fed 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import java.util.Collection;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
@@ -35,88 +35,74 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-
public class NetworkManagerImpl implements NetworkManager {
- private final NetworkDao networkDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- private final VendorSoftwareProductInfoDao vspInfoDao;
- public NetworkManagerImpl(NetworkDao networkDao,
- CompositionEntityDataManager compositionEntityDataManager,
- VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao) {
- this.networkDao = networkDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.vspInfoDao = vendorSoftwareProductInfoDao;
- }
+ private final NetworkDao networkDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
+ private final VendorSoftwareProductInfoDao vspInfoDao;
- @Override
- public Collection<NetworkEntity> listNetworks(String vspId, Version version) {
- return networkDao.list(new NetworkEntity(vspId, version, null));
- }
-
- @Override
- public NetworkEntity createNetwork(NetworkEntity network) {
- if (!vspInfoDao.isManual(network.getVspId(), network.getVersion())) {
- throw new CoreException(
- new CompositionEditNotAllowedErrorBuilder(network.getVspId(), network.getVersion())
- .build());
+ public NetworkManagerImpl(NetworkDao networkDao, CompositionEntityDataManager compositionEntityDataManager,
+ VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao) {
+ this.networkDao = networkDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
+ this.vspInfoDao = vendorSoftwareProductInfoDao;
}
- return null;
- }
-
- @Override
- public CompositionEntityValidationData updateNetwork(NetworkEntity network) {
- NetworkEntity retrieved = getValidatedNetwork(network.getVspId(), network.getVersion(), network.getId());
-
- NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(network.getVspId(), network.getVersion()));
- schemaInput.setNetwork(retrieved.getNetworkCompositionData());
- CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(network, SchemaTemplateContext.composition, schemaInput);
- if (CollectionUtils.isEmpty(validationData.getErrors())) {
- networkDao.update(network);
+ @Override
+ public Collection<NetworkEntity> listNetworks(String vspId, Version version) {
+ return networkDao.list(new NetworkEntity(vspId, version, null));
}
- return validationData;
- }
- @Override
- public CompositionEntityResponse<Network> getNetwork(String vspId, Version version,
- String networkId) {
- NetworkEntity networkEntity = getValidatedNetwork(vspId, version, networkId);
- Network network = networkEntity.getNetworkCompositionData();
-
- NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(vspId, version));
- schemaInput.setNetwork(network);
-
- CompositionEntityResponse<Network> response = new CompositionEntityResponse<>();
- response.setId(networkId);
- response.setData(network);
- response.setSchema(getCompositionSchema(schemaInput));
- return response;
- }
+ @Override
+ public NetworkEntity createNetwork(NetworkEntity network) {
+ if (!vspInfoDao.isManual(network.getVspId(), network.getVersion())) {
+ throw new CoreException(new CompositionEditNotAllowedErrorBuilder(network.getVspId(), network.getVersion()).build());
+ }
+ return null;
+ }
+ @Override
+ public CompositionEntityValidationData updateNetwork(NetworkEntity network) {
+ NetworkEntity retrieved = getValidatedNetwork(network.getVspId(), network.getVersion(), network.getId());
+ NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(network.getVspId(), network.getVersion()));
+ schemaInput.setNetwork(retrieved.getNetworkCompositionData());
+ CompositionEntityValidationData validationData = compositionEntityDataManager
+ .validateEntity(network, SchemaTemplateContext.composition, schemaInput);
+ if (CollectionUtils.isEmpty(validationData.getErrors())) {
+ networkDao.update(network);
+ }
+ return validationData;
+ }
- private NetworkEntity getValidatedNetwork(String vspId, Version version, String networkId) {
- NetworkEntity retrieved = networkDao.get(new NetworkEntity(vspId, version, networkId));
- VersioningUtil.validateEntityExistence(retrieved, new NetworkEntity(vspId, version, networkId),
- VspDetails.ENTITY_TYPE);
- return retrieved;
- }
+ @Override
+ public CompositionEntityResponse<Network> getNetwork(String vspId, Version version, String networkId) {
+ NetworkEntity networkEntity = getValidatedNetwork(vspId, version, networkId);
+ Network network = networkEntity.getNetworkCompositionData();
+ NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+ schemaInput.setNetwork(network);
+ CompositionEntityResponse<Network> response = new CompositionEntityResponse<>();
+ response.setId(networkId);
+ response.setData(network);
+ response.setSchema(getCompositionSchema(schemaInput));
+ return response;
+ }
- @Override
- public void deleteNetwork(String vspId, Version version, String networkId) {
- if (!vspInfoDao.isManual(vspId, version)) {
- throw new CoreException(
- new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+ private NetworkEntity getValidatedNetwork(String vspId, Version version, String networkId) {
+ NetworkEntity retrieved = networkDao.get(new NetworkEntity(vspId, version, networkId));
+ VersioningUtil.validateEntityExistence(retrieved, new NetworkEntity(vspId, version, networkId), VspDetails.ENTITY_TYPE);
+ return retrieved;
}
- }
+ @Override
+ public void deleteNetwork(String vspId, Version version, String networkId) {
+ if (!vspInfoDao.isManual(vspId, version)) {
+ throw new CoreException(new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
+ }
+ }
- protected String getCompositionSchema(NetworkCompositionSchemaInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.network, schemaInput);
- }
+ protected String getCompositionSchema(NetworkCompositionSchemaInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.network, schemaInput);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java
index 234dc09ebe..5dd5ccbc9c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
@@ -28,15 +27,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
public class NicManagerFactoryImpl extends NicManagerFactory {
- private static final NicManager INSTANCE =
- new NicManagerImpl(
- NicDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
- NetworkManagerFactory.getInstance().createInterface(),
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
- @Override
- public NicManager createInterface() {
- return INSTANCE;
- }
+ private static final NicManager INSTANCE = new NicManagerImpl(NicDaoFactory.getInstance().createInterface(),
+ CompositionEntityDataManagerFactory.getInstance().createInterface(), NetworkManagerFactory.getInstance().createInterface(),
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
+
+ @Override
+ public NicManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
index 0ed58a7703..0cf85d3acd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -28,7 +30,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.*;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DeleteNicErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateNicInComponentErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NicErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NicInternalNetworkErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NicNetworkIdNotAllowedExternalNetworkErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
@@ -42,202 +49,162 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTempl
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
public class NicManagerImpl implements NicManager {
- private final NicDao nicDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- private final NetworkManager networkManager;
- private final VendorSoftwareProductInfoDao vspInfoDao;
-
- public NicManagerImpl(NicDao nicDao,
- CompositionEntityDataManager compositionEntityDataManager,
- NetworkManager networkManager,
- VendorSoftwareProductInfoDao vspInfoDao) {
- this.nicDao = nicDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.networkManager = networkManager;
- this.vspInfoDao = vspInfoDao;
- }
-
- @Override
- public Collection<NicEntity> listNics(String vspId, Version version, String componentId) {
- Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentId, null));
-
- if (!nics.isEmpty()) {
- Map<String, String> networksNameById = listNetworksNameById(vspId, version);
- nics.forEach(nicEntity -> {
- Nic nic = nicEntity.getNicCompositionData();
- nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
- nicEntity.setNicCompositionData(nic);
- });
+
+ private final NicDao nicDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
+ private final NetworkManager networkManager;
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+
+ public NicManagerImpl(NicDao nicDao, CompositionEntityDataManager compositionEntityDataManager, NetworkManager networkManager,
+ VendorSoftwareProductInfoDao vspInfoDao) {
+ this.nicDao = nicDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
+ this.networkManager = networkManager;
+ this.vspInfoDao = vspInfoDao;
}
- return nics;
- }
-
- private Map<String, String> listNetworksNameById(String vspId, Version version) {
- Collection<NetworkEntity> networks = networkManager.listNetworks(vspId, version);
- return networks.stream().collect(Collectors.toMap(NetworkEntity::getId,
- networkEntity -> networkEntity.getNetworkCompositionData().getName()));
- }
-
- @Override
- public NicEntity createNic(NicEntity nic) {
- NicEntity createdNic;
- if (!vspInfoDao.isManual(nic.getVspId(), nic.getVersion())) {
- ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
- .getAddNicNotSupportedHeatOnboardMethodErrorBuilder();
- throw new CoreException(onboardingMethodUpdateErrorCode);
- } else {
- validateNic(nic);
- createdNic = compositionEntityDataManager.createNic(nic);
+
+ @Override
+ public Collection<NicEntity> listNics(String vspId, Version version, String componentId) {
+ Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentId, null));
+ if (!nics.isEmpty()) {
+ Map<String, String> networksNameById = listNetworksNameById(vspId, version);
+ nics.forEach(nicEntity -> {
+ Nic nic = nicEntity.getNicCompositionData();
+ nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
+ nicEntity.setNicCompositionData(nic);
+ });
+ }
+ return nics;
}
- return createdNic;
- }
-
-
- private void validateNic(NicEntity nic) {
- Collection<NicEntity> listNics = listNics(nic.getVspId(), nic.getVersion(), nic
- .getComponentId());
- String networkId = nic.getNicCompositionData().getNetworkId();
- NetworkType networkType = nic.getNicCompositionData().getNetworkType();
- String networkDescription = nic.getNicCompositionData().getNetworkDescription();
-
- if (!nic.getNicCompositionData().getName()
- .matches(VendorSoftwareProductConstants.NAME_PATTERN)) {
- ErrorCode errorCode = NicErrorBuilder
- .getNicNameFormatErrorBuilder(VendorSoftwareProductConstants.NAME_PATTERN);
- throw new CoreException(errorCode);
+
+ private Map<String, String> listNetworksNameById(String vspId, Version version) {
+ Collection<NetworkEntity> networks = networkManager.listNetworks(vspId, version);
+ return networks.stream()
+ .collect(Collectors.toMap(NetworkEntity::getId, networkEntity -> networkEntity.getNetworkCompositionData().getName()));
}
- validateNics(nic, listNics);
+ @Override
+ public NicEntity createNic(NicEntity nic) {
+ NicEntity createdNic;
+ if (!vspInfoDao.isManual(nic.getVspId(), nic.getVersion())) {
+ ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
+ .getAddNicNotSupportedHeatOnboardMethodErrorBuilder();
+ throw new CoreException(onboardingMethodUpdateErrorCode);
+ } else {
+ validateNic(nic);
+ createdNic = compositionEntityDataManager.createNic(nic);
+ }
+ return createdNic;
+ }
+
+ private void validateNic(NicEntity nic) {
+ Collection<NicEntity> listNics = listNics(nic.getVspId(), nic.getVersion(), nic.getComponentId());
+ String networkId = nic.getNicCompositionData().getNetworkId();
+ NetworkType networkType = nic.getNicCompositionData().getNetworkType();
+ String networkDescription = nic.getNicCompositionData().getNetworkDescription();
+ if (!nic.getNicCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) {
+ ErrorCode errorCode = NicErrorBuilder.getNicNameFormatErrorBuilder(VendorSoftwareProductConstants.NAME_PATTERN);
+ throw new CoreException(errorCode);
+ }
+ validateNics(nic, listNics);
+ if (networkType.equals(NetworkType.Internal)) {
+ validateInternalNetworkType(nic, networkId, networkDescription);
+ } else if (networkType.equals(NetworkType.External) && !(networkId == null || networkId.isEmpty())) {
+ final ErrorCode nicNetworkIdNotAllowedExternalNetworkErrorBuilder = new NicNetworkIdNotAllowedExternalNetworkErrorBuilder().build();
+ throw new CoreException(nicNetworkIdNotAllowedExternalNetworkErrorBuilder);
+ }
+ }
- if (networkType.equals(NetworkType.Internal)) {
- validateInternalNetworkType(nic, networkId, networkDescription);
+ private void validateInternalNetworkType(NicEntity nic, String networkId, String networkDescription) {
+ if (!(networkId == null || networkId.isEmpty())) {
+ networkManager.getNetwork(nic.getVspId(), nic.getVersion(), networkId);
+ }
+ if (!(networkDescription == null || networkDescription.isEmpty())) {
+ final ErrorCode nicNetworkDescriptionErrorBuilder = NicInternalNetworkErrorBuilder.getNetworkDescriptionInternalNetworkErrorBuilder();
+ throw new CoreException(nicNetworkDescriptionErrorBuilder);
+ }
+ }
+
+ private void validateNics(NicEntity nic, Collection<NicEntity> listNics) {
+ listNics.forEach(nicEntity -> {
+ Nic nicdata = nicEntity.getNicCompositionData();
+ if (nic.getNicCompositionData().getName().equalsIgnoreCase(nicdata.getName())) {
+ final ErrorCode duplicateNicInComponentErrorBuilder = new DuplicateNicInComponentErrorBuilder(nic.getNicCompositionData().getName(),
+ nic.getComponentId()).build();
+ throw new CoreException(duplicateNicInComponentErrorBuilder);
+ }
+ });
+ }
- } else if (networkType.equals(NetworkType.External)
- && !(networkId == null || networkId.isEmpty())) {
- final ErrorCode nicNetworkIdNotAllowedExternalNetworkErrorBuilder =
- new NicNetworkIdNotAllowedExternalNetworkErrorBuilder().build();
- throw new CoreException(nicNetworkIdNotAllowedExternalNetworkErrorBuilder);
+ @Override
+ public CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId, String nicId) {
+ NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
+ Nic nic = nicEntity.getNicCompositionData();
+ NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(vspId, version));
+ schemaInput.setNic(nic);
+ Map<String, String> networksNameById = listNetworksNameById(vspId, version);
+ nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
+ schemaInput.setNetworkIds(networksNameById.keySet());
+ CompositionEntityResponse<Nic> response = new CompositionEntityResponse<>();
+ response.setId(nicId);
+ response.setData(nic);
+ response.setSchema(getNicCompositionSchema(schemaInput));
+ return response;
}
- }
- private void validateInternalNetworkType(NicEntity nic, String networkId,
- String networkDescription) {
- if (!(networkId == null || networkId.isEmpty())) {
- networkManager.getNetwork(nic.getVspId(), nic.getVersion(), networkId);
+ private NicEntity getValidatedNic(String vspId, Version version, String componentId, String nicId) {
+ NicEntity retrieved = nicDao.get(new NicEntity(vspId, version, componentId, nicId));
+ VersioningUtil.validateEntityExistence(retrieved, new NicEntity(vspId, version, componentId, nicId), VspDetails.ENTITY_TYPE);
+ return retrieved;
}
- if (!(networkDescription == null || networkDescription.isEmpty())) {
- final ErrorCode nicNetworkDescriptionErrorBuilder =
- NicInternalNetworkErrorBuilder.getNetworkDescriptionInternalNetworkErrorBuilder();
- throw new CoreException(nicNetworkDescriptionErrorBuilder);
+ @Override
+ public void deleteNic(String vspId, Version version, String componentId, String nicId) {
+ if (!vspInfoDao.isManual(vspId, version)) {
+ final ErrorCode deleteNicErrorBuilder = DeleteNicErrorBuilder.getDeleteNicForHeatOnboardedVspErrorBuilder();
+ throw new CoreException(deleteNicErrorBuilder);
+ }
+ NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
+ nicDao.delete(nicEntity);
}
- }
-
- private void validateNics(NicEntity nic, Collection<NicEntity> listNics) {
- listNics.forEach(nicEntity -> {
- Nic nicdata = nicEntity.getNicCompositionData();
- if (nic.getNicCompositionData().getName().equalsIgnoreCase(nicdata.getName())) {
- final ErrorCode duplicateNicInComponentErrorBuilder =
- new DuplicateNicInComponentErrorBuilder(nic.getNicCompositionData().getName(),
- nic.getComponentId()).build();
- throw new CoreException(duplicateNicInComponentErrorBuilder);
- }
-
- });
- }
-
- @Override
- public CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId,
- String nicId) {
- NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
- Nic nic = nicEntity.getNicCompositionData();
-
- NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(vspId, version));
- schemaInput.setNic(nic);
- Map<String, String> networksNameById = listNetworksNameById(vspId, version);
- nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
- schemaInput.setNetworkIds(networksNameById.keySet());
-
- CompositionEntityResponse<Nic> response = new CompositionEntityResponse<>();
- response.setId(nicId);
- response.setData(nic);
- response.setSchema(getNicCompositionSchema(schemaInput));
- return response;
- }
-
-
- private NicEntity getValidatedNic(String vspId, Version version, String componentId,
- String nicId) {
- NicEntity retrieved = nicDao.get(new NicEntity(vspId, version, componentId, nicId));
- VersioningUtil
- .validateEntityExistence(retrieved, new NicEntity(vspId, version, componentId, nicId),
- VspDetails.ENTITY_TYPE);
- return retrieved;
- }
-
- @Override
- public void deleteNic(String vspId, Version version, String componentId, String nicId) {
- if (!vspInfoDao.isManual(vspId, version)) {
- final ErrorCode deleteNicErrorBuilder =
- DeleteNicErrorBuilder.getDeleteNicForHeatOnboardedVspErrorBuilder();
- throw new CoreException(deleteNicErrorBuilder);
+
+ @Override
+ public CompositionEntityValidationData updateNic(NicEntity nic) {
+ NicEntity retrieved = getValidatedNic(nic.getVspId(), nic.getVersion(), nic.getComponentId(), nic.getId());
+ NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
+ schemaInput.setManual(vspInfoDao.isManual(nic.getVspId(), nic.getVersion()));
+ schemaInput.setNic(retrieved.getNicCompositionData());
+ CompositionEntityValidationData validationData = compositionEntityDataManager
+ .validateEntity(nic, SchemaTemplateContext.composition, schemaInput);
+ if (CollectionUtils.isEmpty(validationData.getErrors())) {
+ nicDao.update(nic);
+ }
+ return validationData;
}
- NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
- nicDao.delete(nicEntity);
- }
+ @Override
+ public QuestionnaireResponse getNicQuestionnaire(String vspId, Version version, String componentId, String nicId) {
+ QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
+ NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, version, componentId, nicId);
+ VersioningUtil.validateEntityExistence(nicQuestionnaire, new NicEntity(vspId, version, componentId, nicId), VspDetails.ENTITY_TYPE);
+ questionnaireResponse.setData(nicQuestionnaire.getQuestionnaireData());
+ questionnaireResponse.setSchema(getNicQuestionnaireSchema(null));
+ return questionnaireResponse;
+ }
- @Override
- public CompositionEntityValidationData updateNic(NicEntity nic) {
- NicEntity retrieved =
- getValidatedNic(nic.getVspId(), nic.getVersion(), nic.getComponentId(), nic.getId());
+ @Override
+ public void updateNicQuestionnaire(String vspId, Version version, String componentId, String nicId, String questionnaireData) {
+ getNic(vspId, version, componentId, nicId);
+ nicDao.updateQuestionnaireData(vspId, version, componentId, nicId, questionnaireData);
+ }
- NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
- schemaInput.setManual(vspInfoDao.isManual(nic.getVspId(), nic.getVersion()));
- schemaInput.setNic(retrieved.getNicCompositionData());
+ protected String getNicQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, schemaInput);
+ }
- CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(nic, SchemaTemplateContext.composition, schemaInput);
- if (CollectionUtils.isEmpty(validationData.getErrors())) {
- nicDao.update(nic);
+ protected String getNicCompositionSchema(NicCompositionSchemaInput schemaInput) {
+ return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.nic, schemaInput);
}
- return validationData;
- }
-
- @Override
- public QuestionnaireResponse getNicQuestionnaire(String vspId, Version version,
- String componentId, String nicId) {
- QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
- NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, version, componentId, nicId);
- VersioningUtil.validateEntityExistence(nicQuestionnaire,
- new NicEntity(vspId, version, componentId, nicId), VspDetails.ENTITY_TYPE);
-
- questionnaireResponse.setData(nicQuestionnaire.getQuestionnaireData());
- questionnaireResponse.setSchema(getNicQuestionnaireSchema(null));
- return questionnaireResponse;
- }
-
- @Override
- public void updateNicQuestionnaire(String vspId, Version version, String componentId,
- String nicId, String questionnaireData) {
- getNic(vspId, version, componentId, nicId);
-
- nicDao.updateQuestionnaireData(vspId, version, componentId, nicId, questionnaireData);
- }
-
- protected String getNicQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, schemaInput);
- }
-
- protected String getNicCompositionSchema(NicCompositionSchemaInput schemaInput) {
- return SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, schemaInput);
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
index ae0283b568..03b2654f2f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
@@ -21,17 +20,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateMan
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
-public class OrchestrationTemplateCandidateManagerFactoryImpl extends
- OrchestrationTemplateCandidateManagerFactory {
+public class OrchestrationTemplateCandidateManagerFactoryImpl extends OrchestrationTemplateCandidateManagerFactory {
- private static final OrchestrationTemplateCandidateManager INSTANCE =
- new OrchestrationTemplateCandidateManagerImpl(
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- CandidateServiceFactory.getInstance().createInterface()
- );
+ private static final OrchestrationTemplateCandidateManager INSTANCE = new OrchestrationTemplateCandidateManagerImpl(
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(), CandidateServiceFactory.getInstance().createInterface());
- @Override
- public OrchestrationTemplateCandidateManager createInterface() {
- return INSTANCE;
- }
+ @Override
+ public OrchestrationTemplateCandidateManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
index d4c7151c17..7e576789d5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import java.io.IOException;
@@ -47,108 +46,83 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
import org.openecomp.sdc.versioning.dao.types.Version;
-public class OrchestrationTemplateCandidateManagerImpl
- implements OrchestrationTemplateCandidateManager {
-
- private final VendorSoftwareProductInfoDao vspInfoDao;
- private final CandidateService candidateService;
+public class OrchestrationTemplateCandidateManagerImpl implements OrchestrationTemplateCandidateManager {
- public OrchestrationTemplateCandidateManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
- CandidateService candidateService
- ) {
- this.vspInfoDao = vspInfoDao;
- this.candidateService = candidateService;
- }
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+ private final CandidateService candidateService;
- @Override
- public UploadFileResponse upload(final VspDetails vspDetails,
- final OnboardPackageInfo onboardPackageInfo) {
- final OnboardPackage onboardPackage = onboardPackageInfo.getOnboardPackage();
- final OrchestrationTemplateFileHandler orchestrationTemplateFileHandler =
- OrchestrationUploadFactory.createOrchestrationTemplateFileHandler(onboardPackageInfo.getPackageType());
-
- final UploadFileResponse uploadFileResponse =
- orchestrationTemplateFileHandler.upload(vspDetails, onboardPackageInfo, candidateService);
- uploadFileResponse.setNetworkPackageName(onboardPackage.getFilename());
- return uploadFileResponse;
- }
+ public OrchestrationTemplateCandidateManagerImpl(VendorSoftwareProductInfoDao vspInfoDao, CandidateService candidateService) {
+ this.vspInfoDao = vspInfoDao;
+ this.candidateService = candidateService;
+ }
- @Override
- public OrchestrationTemplateActionResponse process(String vspId, Version version) {
- OrchestrationTemplateCandidateData candidate =
- candidateService.getOrchestrationTemplateCandidate(vspId, version)
- .orElseThrow(() -> new CoreException(
- new OrchestrationTemplateNotFoundErrorBuilder(vspId).build()));
+ @Override
+ public UploadFileResponse upload(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo) {
+ final OnboardPackage onboardPackage = onboardPackageInfo.getOnboardPackage();
+ final OrchestrationTemplateFileHandler orchestrationTemplateFileHandler = OrchestrationUploadFactory
+ .createOrchestrationTemplateFileHandler(onboardPackageInfo.getPackageType());
+ final UploadFileResponse uploadFileResponse = orchestrationTemplateFileHandler.upload(vspDetails, onboardPackageInfo, candidateService);
+ uploadFileResponse.setNetworkPackageName(onboardPackage.getFilename());
+ return uploadFileResponse;
+ }
- return OrchestrationProcessFactory.getInstance(candidate.getFileSuffix())
- .map(processor -> processor.process(getVspDetails(vspId, version), candidate))
- .orElse(new OrchestrationTemplateActionResponse());
- }
+ @Override
+ public OrchestrationTemplateActionResponse process(String vspId, Version version) {
+ OrchestrationTemplateCandidateData candidate = candidateService.getOrchestrationTemplateCandidate(vspId, version)
+ .orElseThrow(() -> new CoreException(new OrchestrationTemplateNotFoundErrorBuilder(vspId).build()));
+ return OrchestrationProcessFactory.getInstance(candidate.getFileSuffix())
+ .map(processor -> processor.process(getVspDetails(vspId, version), candidate)).orElse(new OrchestrationTemplateActionResponse());
+ }
- @Override
- public Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version) {
- return candidateService.getOrchestrationTemplateCandidateFileDataStructure(vspId, version);
- }
+ @Override
+ public Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version) {
+ return candidateService.getOrchestrationTemplateCandidateFileDataStructure(vspId, version);
+ }
- @Override
- public ValidationResponse updateFilesDataStructure(String vspId, Version version,
- FilesDataStructure fileDataStructure) {
- ValidationResponse response = new ValidationResponse();
- Optional<List<ErrorMessage>> validateErrors =
- candidateService.validateFileDataStructure(fileDataStructure);
- if (validateErrors.isPresent()) {
- List<ErrorMessage> errorMessages = validateErrors.get();
- if (CollectionUtils.isNotEmpty(errorMessages)) {
- Map<String, List<ErrorMessage>> errorsMap = Collections.singletonMap(SdcCommon.UPLOAD_FILE, errorMessages);
- response.setUploadDataErrors(errorsMap);
+ @Override
+ public ValidationResponse updateFilesDataStructure(String vspId, Version version, FilesDataStructure fileDataStructure) {
+ ValidationResponse response = new ValidationResponse();
+ Optional<List<ErrorMessage>> validateErrors = candidateService.validateFileDataStructure(fileDataStructure);
+ if (validateErrors.isPresent()) {
+ List<ErrorMessage> errorMessages = validateErrors.get();
+ if (CollectionUtils.isNotEmpty(errorMessages)) {
+ Map<String, List<ErrorMessage>> errorsMap = Collections.singletonMap(SdcCommon.UPLOAD_FILE, errorMessages);
+ response.setUploadDataErrors(errorsMap);
+ return response;
+ }
+ }
+ candidateService.updateOrchestrationTemplateCandidateFileDataStructure(vspId, version, fileDataStructure);
return response;
- }
}
- candidateService
- .updateOrchestrationTemplateCandidateFileDataStructure(vspId, version, fileDataStructure);
- return response;
- }
- @Override
-
- public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
- VspDetails vspDetails = getVspDetails(vspId, version);
-
- Optional<OrchestrationTemplateCandidateData> candidateDataEntity =
- candidateService.getOrchestrationTemplateCandidate(vspId, version);
-
- if (!candidateDataEntity.isPresent()) {
- return Optional.empty();
+ @Override
+ public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
+ VspDetails vspDetails = getVspDetails(vspId, version);
+ Optional<OrchestrationTemplateCandidateData> candidateDataEntity = candidateService.getOrchestrationTemplateCandidate(vspId, version);
+ if (!candidateDataEntity.isPresent()) {
+ return Optional.empty();
+ }
+ if (CommonUtil.isFileOriginFromZip(candidateDataEntity.get().getFileSuffix())) {
+ FilesDataStructure structure = JsonUtil.json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
+ String manifest = candidateService.createManifest(vspDetails, structure);
+ OnboardingTypesEnum type = OnboardingTypesEnum.getOnboardingTypesEnum(candidateDataEntity.get().getFileSuffix());
+ return Optional.of(new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(),
+ candidateService.replaceManifestInZip(candidateDataEntity.get().getContentData(), manifest, type)));
+ }
+ return Optional.of(new ImmutablePair<>(candidateDataEntity.get().getFileSuffix(), candidateDataEntity.get().getContentData().array()));
}
- if (CommonUtil.isFileOriginFromZip(candidateDataEntity.get().getFileSuffix())) {
- FilesDataStructure structure = JsonUtil
- .json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
- String manifest = candidateService.createManifest(vspDetails, structure);
- OnboardingTypesEnum type =
- OnboardingTypesEnum.getOnboardingTypesEnum(candidateDataEntity.get().getFileSuffix());
- return Optional.of(
- new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(), candidateService
- .replaceManifestInZip(candidateDataEntity.get().getContentData(),
- manifest, type)));
+ @Override
+ public Optional<OrchestrationTemplateCandidateData> getInfo(String vspId, Version version) {
+ return candidateService.getOrchestrationTemplateCandidateInfo(vspId, version);
}
- return Optional.of(
- new ImmutablePair<>(candidateDataEntity.get().getFileSuffix(), candidateDataEntity.get()
- .getContentData().array()));
- }
-
- @Override
- public Optional<OrchestrationTemplateCandidateData> getInfo(String vspId, Version version) {
- return candidateService.getOrchestrationTemplateCandidateInfo(vspId, version);
- }
-
- @Override
- public void abort(String vspId, Version version) {
- candidateService.deleteOrchestrationTemplateCandidate(vspId, version);
- }
+ @Override
+ public void abort(String vspId, Version version) {
+ candidateService.deleteOrchestrationTemplateCandidate(vspId, version);
+ }
- private VspDetails getVspDetails(String vspId, Version version) {
- return vspInfoDao.get(new VspDetails(vspId, version));
- }
-} \ No newline at end of file
+ private VspDetails getVspDetails(String vspId, Version version) {
+ return vspInfoDao.get(new VspDetails(vspId, version));
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerFactoryImpl.java
index b1b8ff4d42..9f10df65a5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.core.dao.UniqueValueDaoFactory;
@@ -26,12 +25,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.ProcessManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
public class ProcessManagerFactoryImpl extends ProcessManagerFactory {
- private static final ProcessManager INSTANCE =
- new ProcessManagerImpl(ProcessDaoFactory.getInstance().createInterface(),
- UniqueValueDaoFactory.getInstance().createInterface());
- @Override
- public ProcessManager createInterface() {
- return INSTANCE;
- }
+ private static final ProcessManager INSTANCE = new ProcessManagerImpl(ProcessDaoFactory.getInstance().createInterface(),
+ UniqueValueDaoFactory.getInstance().createInterface());
+
+ @Override
+ public ProcessManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
index 855007dfd9..a5347350b0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
@@ -13,9 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.Collection;
import org.openecomp.core.dao.UniqueValueDao;
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.file.FileUtils;
@@ -31,191 +36,144 @@ import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.Collection;
-
public class ProcessManagerImpl implements ProcessManager {
- private static final String PROCESS_ARTIFACT_NOT_EXIST_MSG =
- "Process artifact for process with Id %s does not exist for %s with Id %s and version %s";
- private final ProcessDao processDao;
- private final UniqueValueUtil uniqueValueUtil;
-
- public ProcessManagerImpl(ProcessDao processDao, UniqueValueDao uniqueValueDao) {
- this.processDao = processDao;
- this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
- }
-
- @Override
- public Collection<ProcessEntity> listProcesses(String vspId, Version version,
- String componentId) {
- return processDao.list(new ProcessEntity(vspId, version, componentId, null));
- }
-
- @Override
- public void deleteProcesses(String vspId, Version version, String componentId) {
- ProcessEntity allProcesses = new ProcessEntity(vspId, version, componentId, null);
- Collection<ProcessEntity> processes = processDao.list(allProcesses);
-
- if (!processes.isEmpty()) {
- for (ProcessEntity process : processes) {
- deleteUniqueValue(process.getVspId(), process.getVersion(), process.getComponentId(),
- process.getName());
- }
- }
-
- if (componentId == null) {
- processDao.deleteVspAll(vspId,version);
- } else {
- processDao.deleteAll(allProcesses);
- }
- }
-
- @Override
- public ProcessEntity createProcess(ProcessEntity process) {
- validateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
- process.getName());
-
- processDao.create(process);
- createUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
- process.getName());
- return process;
- }
-
- @Override
- public ProcessEntity getProcess(String vspId, Version version, String componentId,
- String processId) {
- ProcessEntity retrieved =
- processDao.get(new ProcessEntity(vspId, version, componentId, processId));
- validateProcessExistence(vspId, version, componentId, processId, retrieved);
- return retrieved;
- }
-
- @Override
- public void updateProcess(ProcessEntity process) {
- ProcessEntity retrieved = processDao.get(process);
- validateProcessExistence(process.getVspId(), process.getVersion(), process.getComponentId(),
- process.getId(), retrieved);
-
- updateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
- retrieved.getName(), process.getName());
- processDao.update(process);
- }
-
- @Override
- public void deleteProcess(String vspId, Version version, String componentId, String processId) {
- ProcessEntity retrieved = getProcess(vspId, version, componentId, processId);
-
- processDao.delete(retrieved);
- deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
- retrieved.getName());
- }
-
-
- @Override
- public File getProcessArtifact(String vspId, Version version, String componentId,
- String processId) {
- ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
-
- File file = new File(String.format("%s_%s_%s", vspId, componentId, processId));
- try (FileOutputStream fos = new FileOutputStream(file)) {
- fos.write(retrieved.getArtifact().array());
- } catch (IOException exception) {
- throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
- }
- return file;
- }
-
- @Override
- public void deleteProcessArtifact(String vspId, Version version, String componentId,
- String processId) {
- ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
-
- processDao.deleteArtifact(retrieved);
- }
-
- @Override
- public void uploadProcessArtifact(InputStream artifactFile, String artifactFileName, String vspId,
- Version version, String componentId, String processId) {
- ProcessEntity process = getProcess(vspId, version, componentId, processId);
- process.setArtifactName(artifactFileName);
- process.setArtifact(readArtifact(artifactFile));
- processDao.uploadArtifact(process);
- }
-
- private ProcessEntity getValidatedProcessArtifact(String vspId, Version version,
- String componentId, String processId) {
- ProcessEntity retrieved =
- processDao.getArtifact(new ProcessEntity(vspId, version, componentId, processId));
- validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved);
- return retrieved;
- }
-
- private ByteBuffer readArtifact(InputStream artifactInputStream) {
- if (artifactInputStream == null) {
- throw new CoreException(new UploadInvalidErrorBuilder().build());
- }
- try {
- return ByteBuffer.wrap(FileUtils.toByteArray(artifactInputStream));
- } catch (RuntimeException exception) {
- throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
- }
- }
-
-
- private void validateProcessExistence(String vspId, Version version, String componentId,
- String processId, ProcessEntity retrieved) {
- VersioningUtil.validateEntityExistence(retrieved,
- new ProcessEntity(vspId, version, componentId, processId),
- VspDetails.ENTITY_TYPE);
- }
-
- private void validateProcessArtifactExistence(String vspId, Version version, String componentId,
- String processId, ProcessEntity retrieved) {
- ProcessEntity inputProcess = new ProcessEntity(vspId, version, componentId, processId);
- VersioningUtil.validateEntityExistence(retrieved, inputProcess, VspDetails.ENTITY_TYPE);
- if (retrieved.getArtifact() == null) {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND)
- .withMessage(String.format(PROCESS_ARTIFACT_NOT_EXIST_MSG,
- processId, VspDetails.ENTITY_TYPE, vspId, version)).build());
- }
- }
-
-
- protected void validateUniqueName(String vspId, Version version, String componentId,
- String processName) {
- uniqueValueUtil.validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME,
- vspId, version.getId(), componentId, processName);
- }
-
- protected void createUniqueName(String vspId, Version version, String componentId,
- String processName) {
- uniqueValueUtil
- .createUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId,
- version.getId(), componentId, processName);
- }
-
- protected void updateUniqueName(String vspId, Version version, String componentId,
- String oldProcessName, String newProcessName) {
- uniqueValueUtil
- .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, oldProcessName,
- newProcessName, vspId, version.getId(), componentId);
- }
-
- protected void deleteUniqueValue(String vspId, Version version, String componentId,
- String processName) {
- if (componentId == null) {
- uniqueValueUtil
- .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId,
- version.getId(), processName);
- }
- uniqueValueUtil
- .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId,
- version.getId(), componentId, processName);
- }
+ private static final String PROCESS_ARTIFACT_NOT_EXIST_MSG = "Process artifact for process with Id %s does not exist for %s with Id %s and version %s";
+ private final ProcessDao processDao;
+ private final UniqueValueUtil uniqueValueUtil;
+
+ public ProcessManagerImpl(ProcessDao processDao, UniqueValueDao uniqueValueDao) {
+ this.processDao = processDao;
+ this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
+ }
+
+ @Override
+ public Collection<ProcessEntity> listProcesses(String vspId, Version version, String componentId) {
+ return processDao.list(new ProcessEntity(vspId, version, componentId, null));
+ }
+
+ @Override
+ public void deleteProcesses(String vspId, Version version, String componentId) {
+ ProcessEntity allProcesses = new ProcessEntity(vspId, version, componentId, null);
+ Collection<ProcessEntity> processes = processDao.list(allProcesses);
+ if (!processes.isEmpty()) {
+ for (ProcessEntity process : processes) {
+ deleteUniqueValue(process.getVspId(), process.getVersion(), process.getComponentId(), process.getName());
+ }
+ }
+ if (componentId == null) {
+ processDao.deleteVspAll(vspId, version);
+ } else {
+ processDao.deleteAll(allProcesses);
+ }
+ }
+
+ @Override
+ public ProcessEntity createProcess(ProcessEntity process) {
+ validateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(), process.getName());
+ processDao.create(process);
+ createUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(), process.getName());
+ return process;
+ }
+
+ @Override
+ public ProcessEntity getProcess(String vspId, Version version, String componentId, String processId) {
+ ProcessEntity retrieved = processDao.get(new ProcessEntity(vspId, version, componentId, processId));
+ validateProcessExistence(vspId, version, componentId, processId, retrieved);
+ return retrieved;
+ }
+
+ @Override
+ public void updateProcess(ProcessEntity process) {
+ ProcessEntity retrieved = processDao.get(process);
+ validateProcessExistence(process.getVspId(), process.getVersion(), process.getComponentId(), process.getId(), retrieved);
+ updateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(), retrieved.getName(), process.getName());
+ processDao.update(process);
+ }
+
+ @Override
+ public void deleteProcess(String vspId, Version version, String componentId, String processId) {
+ ProcessEntity retrieved = getProcess(vspId, version, componentId, processId);
+ processDao.delete(retrieved);
+ deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(), retrieved.getName());
+ }
+
+ @Override
+ public File getProcessArtifact(String vspId, Version version, String componentId, String processId) {
+ ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
+ File file = new File(String.format("%s_%s_%s", vspId, componentId, processId));
+ try (FileOutputStream fos = new FileOutputStream(file)) {
+ fos.write(retrieved.getArtifact().array());
+ } catch (IOException exception) {
+ throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
+ }
+ return file;
+ }
+
+ @Override
+ public void deleteProcessArtifact(String vspId, Version version, String componentId, String processId) {
+ ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
+ processDao.deleteArtifact(retrieved);
+ }
+
+ @Override
+ public void uploadProcessArtifact(InputStream artifactFile, String artifactFileName, String vspId, Version version, String componentId,
+ String processId) {
+ ProcessEntity process = getProcess(vspId, version, componentId, processId);
+ process.setArtifactName(artifactFileName);
+ process.setArtifact(readArtifact(artifactFile));
+ processDao.uploadArtifact(process);
+ }
+
+ private ProcessEntity getValidatedProcessArtifact(String vspId, Version version, String componentId, String processId) {
+ ProcessEntity retrieved = processDao.getArtifact(new ProcessEntity(vspId, version, componentId, processId));
+ validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved);
+ return retrieved;
+ }
+
+ private ByteBuffer readArtifact(InputStream artifactInputStream) {
+ if (artifactInputStream == null) {
+ throw new CoreException(new UploadInvalidErrorBuilder().build());
+ }
+ try {
+ return ByteBuffer.wrap(FileUtils.toByteArray(artifactInputStream));
+ } catch (RuntimeException exception) {
+ throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
+ }
+ }
+
+ private void validateProcessExistence(String vspId, Version version, String componentId, String processId, ProcessEntity retrieved) {
+ VersioningUtil.validateEntityExistence(retrieved, new ProcessEntity(vspId, version, componentId, processId), VspDetails.ENTITY_TYPE);
+ }
+
+ private void validateProcessArtifactExistence(String vspId, Version version, String componentId, String processId, ProcessEntity retrieved) {
+ ProcessEntity inputProcess = new ProcessEntity(vspId, version, componentId, processId);
+ VersioningUtil.validateEntityExistence(retrieved, inputProcess, VspDetails.ENTITY_TYPE);
+ if (retrieved.getArtifact() == null) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND)
+ .withMessage(String.format(PROCESS_ARTIFACT_NOT_EXIST_MSG, processId, VspDetails.ENTITY_TYPE, vspId, version)).build());
+ }
+ }
+
+ protected void validateUniqueName(String vspId, Version version, String componentId, String processName) {
+ uniqueValueUtil
+ .validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId, version.getId(), componentId, processName);
+ }
+
+ protected void createUniqueName(String vspId, Version version, String componentId, String processName) {
+ uniqueValueUtil.createUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId, version.getId(), componentId, processName);
+ }
+
+ protected void updateUniqueName(String vspId, Version version, String componentId, String oldProcessName, String newProcessName) {
+ uniqueValueUtil
+ .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, oldProcessName, newProcessName, vspId, version.getId(),
+ componentId);
+ }
+
+ protected void deleteUniqueValue(String vspId, Version version, String componentId, String processName) {
+ if (componentId == null) {
+ uniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId, version.getId(), processName);
+ }
+ uniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId, version.getId(), componentId, processName);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 3f45885999..82b1d0a64c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.candidateDataNotProcessedOrAbortedErrorBuilder;
@@ -141,6 +140,7 @@ import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager {
+
private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductManager.class);
private VspMergeDao vspMergeDao;
private OrchestrationTemplateDao orchestrationTemplateDao;
@@ -162,51 +162,42 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private UniqueValueUtil uniqueValueUtil;
private CandidateService candidateService;
+ private static ErrorCode createMissingMandatoryFieldError(String fieldName) {
+ return new ValidationErrorBuilder("must be supplied", fieldName).build();
+ }
+
@Override
public ValidationResponse validate(VspDetails vspDetails) throws IOException {
List<ErrorCode> vspErrors = new ArrayList<>(validateVspFields(vspDetails));
ValidationResponse validationResponse = new ValidationResponse();
- if (Objects.nonNull(vspDetails.getOnboardingMethod()) && OnboardingMethod.Manual.name()
- .equals(vspDetails.getOnboardingMethod())) {
+ if (Objects.nonNull(vspDetails.getOnboardingMethod()) && OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod())) {
validateManualOnboardingMethod(vspDetails, validationResponse, vspErrors);
} else {
- validateOrchestrationTemplateCandidate(validationResponse, vspErrors, vspDetails.getId(),
- vspDetails.getVersion());
+ validateOrchestrationTemplateCandidate(validationResponse, vspErrors, vspDetails.getId(), vspDetails.getVersion());
if (!validationResponse.isValid()) {
return validationResponse;
}
validateLicense(vspDetails, vspErrors);
- OrchestrationTemplateEntity orchestrationTemplate =
- orchestrationTemplateDao.get(vspDetails.getId(), vspDetails.getVersion());
- ToscaServiceModel serviceModel =
- serviceModelDao.getServiceModel(vspDetails.getId(), vspDetails.getVersion());
+ OrchestrationTemplateEntity orchestrationTemplate = orchestrationTemplateDao.get(vspDetails.getId(), vspDetails.getVersion());
+ ToscaServiceModel serviceModel = serviceModelDao.getServiceModel(vspDetails.getId(), vspDetails.getVersion());
if (isOrchestrationTemplateMissing(orchestrationTemplate) || isServiceModelMissing(serviceModel)) {
vspErrors.add(VendorSoftwareProductInvalidErrorBuilder
- .vendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(),
- vspDetails.getVersion()));
+ .vendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(), vspDetails.getVersion()));
}
validationResponse.setUploadDataErrors(validateOrchestrationTemplate(orchestrationTemplate));
}
-
- QuestionnaireValidationResult questionnaireValidationResult =
- validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails.getOnboardingMethod());
-
+ QuestionnaireValidationResult questionnaireValidationResult = validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(),
+ vspDetails.getOnboardingMethod());
if (Objects.nonNull(questionnaireValidationResult)) {
if (validationResponse.getQuestionnaireValidationResult() == null
- || validationResponse.getQuestionnaireValidationResult().getValidationData() == null) {
+ || validationResponse.getQuestionnaireValidationResult().getValidationData() == null) {
validationResponse.setQuestionnaireValidationResult(questionnaireValidationResult);
} else {
- validationResponse.getQuestionnaireValidationResult().getValidationData()
- .addAll(questionnaireValidationResult.getValidationData());
+ validationResponse.getQuestionnaireValidationResult().getValidationData().addAll(questionnaireValidationResult.getValidationData());
}
}
-
Collection<ComponentDependencyModelEntity> componentDependencies = componentDependencyModelDao
- .list(new ComponentDependencyModelEntity(
- vspDetails.getId(),
- vspDetails.getVersion(),
- null));
-
+ .list(new ComponentDependencyModelEntity(vspDetails.getId(), vspDetails.getVersion(), null));
if (validateComponentDependencies(componentDependencies)) {
vspErrors.add(ComponentDependencyModelErrorBuilder.getCyclicDependencyComponentErrorBuilder());
}
@@ -216,71 +207,58 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
private void validateLicense(VspDetails vspDetails, List<ErrorCode> vspErrors) {
- if (vspDetails.getVlmVersion() != null || vspDetails.getLicenseAgreement() != null
- || vspDetails.getFeatureGroups() != null) {
+ if (vspDetails.getVlmVersion() != null || vspDetails.getLicenseAgreement() != null || vspDetails.getFeatureGroups() != null) {
vspErrors.addAll(validateMandatoryLicenseFields(vspDetails));
}
}
- private void validateOrchestrationTemplateCandidate(ValidationResponse validationResponse,
- List<ErrorCode> vspErrors, String vspId, Version version) {
+ private void validateOrchestrationTemplateCandidate(ValidationResponse validationResponse, List<ErrorCode> vspErrors, String vspId,
+ Version version) {
orchestrationTemplateCandidateManager.getInfo(vspId, version).ifPresent(candidateInfo -> {
String fileName = candidateInfo.getFileName();
- vspErrors.add(candidateInfo.getValidationData().isEmpty() ? candidateDataNotProcessedOrAbortedErrorBuilder(
- fileName) : invalidProcessedCandidate(fileName));
+ vspErrors.add(candidateInfo.getValidationData().isEmpty() ? candidateDataNotProcessedOrAbortedErrorBuilder(fileName)
+ : invalidProcessedCandidate(fileName));
validationResponse.setVspErrors(vspErrors);
});
}
- private void validateManualOnboardingMethod(VspDetails vspDetails, ValidationResponse validationResponse,
- List<ErrorCode> vspErrors) {
+ private void validateManualOnboardingMethod(VspDetails vspDetails, ValidationResponse validationResponse, List<ErrorCode> vspErrors) {
vspErrors.addAll(validateMandatoryLicenseFields(vspDetails));
-
- Collection<DeploymentFlavorEntity> deploymentFlavors =
- deploymentFlavorDao.list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails.getVersion(), null));
+ Collection<DeploymentFlavorEntity> deploymentFlavors = deploymentFlavorDao
+ .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails.getVersion(), null));
if (CollectionUtils.isEmpty(deploymentFlavors)) {
vspErrors.add(vspMissingDeploymentFlavorErrorBuilder());
}
vspErrors.addAll(validateDeploymentFlavors(deploymentFlavors));
-
- Set<CompositionEntityValidationData> componentValidationResult =
- componentValidation(vspDetails.getId(), vspDetails.getVersion());
+ Set<CompositionEntityValidationData> componentValidationResult = componentValidation(vspDetails.getId(), vspDetails.getVersion());
if (!CollectionUtils.isEmpty(componentValidationResult)) {
if (validationResponse.getQuestionnaireValidationResult() == null
- || validationResponse.getQuestionnaireValidationResult().getValidationData() == null) {
- validationResponse
- .setQuestionnaireValidationResult(new QuestionnaireValidationResult(componentValidationResult));
+ || validationResponse.getQuestionnaireValidationResult().getValidationData() == null) {
+ validationResponse.setQuestionnaireValidationResult(new QuestionnaireValidationResult(componentValidationResult));
} else {
- validationResponse.getQuestionnaireValidationResult().getValidationData()
- .addAll(componentValidationResult);
+ validationResponse.getQuestionnaireValidationResult().getValidationData().addAll(componentValidationResult);
}
}
}
@Override
public Map<String, List<ErrorMessage>> compile(String vspId, Version version) {
- ToscaServiceModel serviceModel =
- OnboardingMethod.Manual.name().equals(getValidatedVsp(vspId, version).getOnboardingMethod())
- //Generate Tosca service model for Manual Onboarding flow
- ? manualVspToscaManager
- .generateToscaModel(manualVspToscaManager.gatherVspInformation(vspId, version))
- : serviceModelDao.getServiceModel(vspId, version);
-
+ ToscaServiceModel serviceModel = OnboardingMethod.Manual.name().equals(getValidatedVsp(vspId, version).getOnboardingMethod())
+ //Generate Tosca service model for Manual Onboarding flow
+ ? manualVspToscaManager.generateToscaModel(manualVspToscaManager.gatherVspInformation(vspId, version))
+ : serviceModelDao.getServiceModel(vspId, version);
return compile(vspId, version, serviceModel);
}
private boolean validateComponentDependencies(Collection<ComponentDependencyModelEntity> componentDependencies) {
ComponentDependencyTracker dependencyTracker = new ComponentDependencyTracker();
-
for (ComponentDependencyModelEntity componentDependency : componentDependencies) {
- dependencyTracker.addDependency(componentDependency.getSourceComponentId(),
- componentDependency.getTargetComponentId());
+ dependencyTracker.addDependency(componentDependency.getSourceComponentId(), componentDependency.getTargetComponentId());
}
return dependencyTracker.isCyclicDependencyPresent();
}
private Collection<ErrorCode> validateDeploymentFlavors(Collection<DeploymentFlavorEntity> deploymentFlavors) {
-
Collection<ErrorCode> errorCodeList = new ArrayList<>();
if (!CollectionUtils.isEmpty(deploymentFlavors)) {
deploymentFlavors.forEach(deploymentFlavor -> {
@@ -288,32 +266,26 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
DeploymentFlavor deploymentLocalFlavor = deployment.getDeploymentFlavorCompositionData();
if (deploymentLocalFlavor != null) {
if (deploymentLocalFlavor.getFeatureGroupId() == null) {
- ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder.
- getFeatureGroupMandatoryErrorBuilder(
- deploymentLocalFlavor
- .getModel());
+ ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
+ .getFeatureGroupMandatoryErrorBuilder(deploymentLocalFlavor.getModel());
errorCodeList.add(deploymentFlavorErrorBuilder);
}
- validateComponentComputeAssociations(errorCodeList, deploymentFlavor, deployment,
- deploymentLocalFlavor);
+ validateComponentComputeAssociations(errorCodeList, deploymentFlavor, deployment, deploymentLocalFlavor);
}
});
}
return errorCodeList;
}
- private void validateComponentComputeAssociations(Collection<ErrorCode> errorCodeList,
- DeploymentFlavorEntity deploymentFlavor, DeploymentFlavorEntity deployment,
- DeploymentFlavor deploymentlocalFlavor) {
- List<ComponentComputeAssociation> componentComputeAssociations =
- deploymentlocalFlavor.getComponentComputeAssociations();
+ private void validateComponentComputeAssociations(Collection<ErrorCode> errorCodeList, DeploymentFlavorEntity deploymentFlavor,
+ DeploymentFlavorEntity deployment, DeploymentFlavor deploymentlocalFlavor) {
+ List<ComponentComputeAssociation> componentComputeAssociations = deploymentlocalFlavor.getComponentComputeAssociations();
if (CollectionUtils.isEmpty(componentComputeAssociations)) {
validateCompositionEntity(errorCodeList, deploymentFlavor, deployment, deploymentlocalFlavor);
} else {
componentComputeAssociations.forEach(componentComputeAssociation -> {
if (componentComputeAssociation == null || !(componentComputeAssociation.getComponentId() != null
- && componentComputeAssociation.getComputeFlavorId()
- != null)) {
+ && componentComputeAssociation.getComputeFlavorId() != null)) {
validateCompositionEntity(errorCodeList, deploymentFlavor, deployment, deploymentlocalFlavor);
}
});
@@ -321,13 +293,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
private void validateCompositionEntity(Collection<ErrorCode> errorCodeList, DeploymentFlavorEntity deploymentFlavor,
- DeploymentFlavorEntity deployment, DeploymentFlavor deploymentlocalFlavor) {
- CompositionEntityValidationData compositionEntityValidationData =
- new CompositionEntityValidationData(CompositionEntityType.deployment, deploymentFlavor.getId());
+ DeploymentFlavorEntity deployment, DeploymentFlavor deploymentlocalFlavor) {
+ CompositionEntityValidationData compositionEntityValidationData = new CompositionEntityValidationData(CompositionEntityType.deployment,
+ deploymentFlavor.getId());
compositionEntityValidationData.setEntityName(deployment.getDeploymentFlavorCompositionData().getModel());
ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
- .getInvalidComponentComputeAssociationErrorBuilder(
- deploymentlocalFlavor.getModel());
+ .getInvalidComponentComputeAssociationErrorBuilder(deploymentlocalFlavor.getModel());
errorCodeList.add(deploymentFlavorErrorBuilder);
}
@@ -338,15 +309,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
components.forEach(component -> {
validateImage(vspId, version, validationData, component);
validateNic(vspId, version, validationData, component);
-
});
}
-
return validationData;
}
- private void validateNic(String vspId, Version version, Set<CompositionEntityValidationData> validationData,
- ComponentEntity component) {
+ private void validateNic(String vspId, Version version, Set<CompositionEntityValidationData> validationData, ComponentEntity component) {
Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, component.getId(), null));
if (CollectionUtils.isNotEmpty(nics)) {
nics.forEach(nicEntity -> {
@@ -354,11 +322,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
NetworkType networkType = nic.getNicCompositionData().getNetworkType();
String networkId = nic.getNicCompositionData().getNetworkId();
if (networkType.equals(NetworkType.Internal) && networkId == null) {
- CompositionEntityValidationData compositionEntityValidationData =
- new CompositionEntityValidationData(CompositionEntityType.nic, nic.getId());
+ CompositionEntityValidationData compositionEntityValidationData = new CompositionEntityValidationData(CompositionEntityType.nic,
+ nic.getId());
compositionEntityValidationData.setEntityName(nic.getNicCompositionData().getName());
- ErrorCode nicInternalNetworkErrorBuilder =
- NicInternalNetworkErrorBuilder.getNicNullNetworkIdInternalNetworkIdErrorBuilder();
+ ErrorCode nicInternalNetworkErrorBuilder = NicInternalNetworkErrorBuilder.getNicNullNetworkIdInternalNetworkIdErrorBuilder();
List<String> errors = new ArrayList<>();
errors.add(nicInternalNetworkErrorBuilder.message());
compositionEntityValidationData.setErrors(errors);
@@ -368,12 +335,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
}
- private void validateImage(String vspId, Version version, Set<CompositionEntityValidationData> validationData,
- ComponentEntity component) {
+ private void validateImage(String vspId, Version version, Set<CompositionEntityValidationData> validationData, ComponentEntity component) {
Collection<ImageEntity> images = imageDao.list(new ImageEntity(vspId, version, component.getId(), null));
if (CollectionUtils.isEmpty(images)) {
- CompositionEntityValidationData compositionEntityValidationData =
- new CompositionEntityValidationData(component.getType(), component.getId());
+ CompositionEntityValidationData compositionEntityValidationData = new CompositionEntityValidationData(component.getType(),
+ component.getId());
compositionEntityValidationData.setEntityName(component.getComponentCompositionData().getDisplayName());
ErrorCode vfcMissingImageErrorBuilder = ComponentErrorBuilder.vfcMissingImageErrorBuilder();
List<String> errors = new ArrayList<>();
@@ -385,7 +351,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private List<ErrorCode> validateVspFields(VspDetails vspDetails) {
List<ErrorCode> errors = new ArrayList<>();
-
if (vspDetails.getName() == null) {
errors.add(createMissingMandatoryFieldError("name"));
}
@@ -418,52 +383,39 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return errors;
}
- private static ErrorCode createMissingMandatoryFieldError(String fieldName) {
- return new ValidationErrorBuilder("must be supplied", fieldName).build();
- }
-
- private Map<String, List<ErrorMessage>> compile(String vendorSoftwareProductId, Version version,
- ToscaServiceModel serviceModel) {
+ private Map<String, List<ErrorMessage>> compile(String vendorSoftwareProductId, Version version, ToscaServiceModel serviceModel) {
if (isServiceModelMissing(serviceModel)) {
return null;
}
-
enrichedServiceModelDao.deleteAll(vendorSoftwareProductId, version);
-
- EnrichmentManager<ToscaServiceModel> enrichmentManager =
- EnrichmentManagerFactory.getInstance().createInterface();
+ EnrichmentManager<ToscaServiceModel> enrichmentManager = EnrichmentManagerFactory.getInstance().createInterface();
enrichmentManager.init(vendorSoftwareProductId, version);
enrichmentManager.setModel(serviceModel);
Map<String, List<ErrorMessage>> enrichErrors = enrichmentManager.enrich();
-
enrichedServiceModelDao.storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel());
-
return enrichErrors;
}
private Collection<ErrorCode> validateLicensingData(VspDetails vspDetails) {
if (vspDetails.getVendorId() != null) {
- Optional<ErrorCode> errorCode =
- vendorLicenseFacade.validateVendorForUsage(vspDetails.getVendorId(), vspDetails.getVlmVersion());
+ Optional<ErrorCode> errorCode = vendorLicenseFacade.validateVendorForUsage(vspDetails.getVendorId(), vspDetails.getVlmVersion());
if (errorCode.isPresent()) {
return Collections.singleton(errorCode.get());
}
}
-
- if (vspDetails.getVendorId() == null || vspDetails.getVlmVersion() == null
- || vspDetails.getLicenseAgreement() == null || CollectionUtils
- .isEmpty(vspDetails.getFeatureGroups())) {
+ if (vspDetails.getVendorId() == null || vspDetails.getVlmVersion() == null || vspDetails.getLicenseAgreement() == null || CollectionUtils
+ .isEmpty(vspDetails.getFeatureGroups())) {
return Collections.emptyList();
}
- return vendorLicenseFacade.validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(),
- vspDetails.getLicenseAgreement(), vspDetails.getFeatureGroups());
+ return vendorLicenseFacade.validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(), vspDetails.getLicenseAgreement(),
+ vspDetails.getFeatureGroups());
}
@Override
public VspDetails createVsp(VspDetails vspDetails) {
vspInfoDao.create(vspDetails);
vspInfoDao.updateQuestionnaireData(vspDetails.getId(), vspDetails.getVersion(),
- new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData());
+ new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData());
return vspDetails;
}
@@ -471,16 +423,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
public void updateVsp(VspDetails vspDetails) {
VspDetails retrieved = vspInfoDao.get(vspDetails);
if (retrieved == null) {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder().withMessage(
- String.format("Vsp with id %s and version %s does not exist.", vspDetails.getId(),
- vspDetails.getVersion().getId()))).build());
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()
+ .withMessage(String.format("Vsp with id %s and version %s does not exist.", vspDetails.getId(), vspDetails.getVersion().getId())))
+ .build());
}
vspDetails.setOnboardingMethod(retrieved.getOnboardingMethod());
-
//If any existing feature group is removed from VSP which is also associated in DF then
+
//update DF to remove feature group associations.
updateDeploymentFlavor(vspDetails);
-
updateUniqueName(retrieved.getName(), vspDetails.getName());
vspInfoDao.update(vspDetails);
}
@@ -489,10 +440,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
final List<String> featureGroups = vspDetails.getFeatureGroups();
if (featureGroups != null) {
final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deploymentFlavorDao
- .list(new DeploymentFlavorEntity(
- vspDetails.getId(),
- vspDetails.getVersion(),
- null));
+ .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails.getVersion(), null));
if (Objects.nonNull(deploymentFlavorEntities)) {
for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
updateDeploymentFlavourEntity(featureGroups, deploymentFlavorEntity);
@@ -501,19 +449,16 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
}
- private void updateDeploymentFlavourEntity(List<String> featureGroups,
- DeploymentFlavorEntity deploymentFlavorEntity) {
+ private void updateDeploymentFlavourEntity(List<String> featureGroups, DeploymentFlavorEntity deploymentFlavorEntity) {
final String featureGroupId = deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId();
if (!featureGroups.contains(featureGroupId)) {
- DeploymentFlavor deploymentFlavorCompositionData =
- deploymentFlavorEntity.getDeploymentFlavorCompositionData();
+ DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData();
deploymentFlavorCompositionData.setFeatureGroupId(null);
deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorCompositionData);
deploymentFlavorDao.update(deploymentFlavorEntity);
}
}
-
@Override
public VspDetails getVsp(String vspId, Version version) {
return getValidatedVsp(vspId, version);
@@ -543,14 +488,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
if (packageInfo == null) {
throw new CoreException(new PackageNotFoundErrorBuilder(vspId, version).build());
}
-
ByteBuffer translatedFileBuffer = packageInfo.getTranslatedFile();
if (translatedFileBuffer == null) {
throw new CoreException(new PackageInvalidErrorBuilder(vspId, version).build());
}
-
File translatedFile = new File(VendorSoftwareProductConstants.VSP_PACKAGE_ZIP);
-
try (FileOutputStream fos = new FileOutputStream(translatedFile)) {
fos.write(translatedFileBuffer.array());
} catch (IOException exception) {
@@ -566,11 +508,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
if (contentData == null) {
return new byte[0];
}
-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- try (final ZipOutputStream zos = new ZipOutputStream(baos);
- ZipInputStream ignored = new ZipInputStream(new ByteArrayInputStream(contentData.array()))) {
+ try (final ZipOutputStream zos = new ZipOutputStream(baos); ZipInputStream ignored = new ZipInputStream(
+ new ByteArrayInputStream(contentData.array()))) {
zos.write(contentData.array());
} catch (IOException exception) {
throw new CoreException(new FileCreationErrorBuilder(vspId).build(), exception);
@@ -585,9 +525,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public Optional<FilesDataStructure> getOrchestrationTemplateStructure(String vspId, Version version) {
- Optional<String> jsonFileDataStructure =
- orchestrationTemplateDao.getOrchestrationTemplateStructure(vspId, version);
-
+ Optional<String> jsonFileDataStructure = orchestrationTemplateDao.getOrchestrationTemplateStructure(vspId, version);
if (jsonFileDataStructure.isPresent() && JsonUtil.isValidJson(jsonFileDataStructure.get())) {
return Optional.of(JsonUtil.json2Object(jsonFileDataStructure.get(), FilesDataStructure.class));
} else {
@@ -604,10 +542,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
populateVersionsForVlm(vspDetails.getVendorId(), vlmVersion);
}
final PackageInfo packageInfo = createPackageInfo(vspDetails);
-
final ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar = new ToscaFileOutputServiceCsarImpl();
- final FileContentHandler licenseArtifacts = licenseArtifactsService.createLicenseArtifacts(vspDetails.getId(),
- vspDetails.getVendorId(), vlmVersion, vspDetails.getFeatureGroups());
+ final FileContentHandler licenseArtifacts = licenseArtifactsService
+ .createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion, vspDetails.getFeatureGroups());
final ETSIService etsiService = new ETSIServiceImpl();
if (etsiService.isSol004WithToscaMetaDirectory(toscaServiceModel.getArtifactFiles())) {
final FileContentHandler handler = toscaServiceModel.getArtifactFiles();
@@ -617,20 +554,18 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
packageInfo.setResourceType(etsiService.getResourceType(manifest).name());
packageInfo.setVendorRelease(etsiService.getHighestCompatibleSpecificationVersion(handler).getOriginalValue());
}
- packageInfo.setTranslatedFile(
- ByteBuffer.wrap(toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts)));
-
+ packageInfo.setTranslatedFile(ByteBuffer.wrap(toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts)));
packageInfoDao.create(packageInfo);
return packageInfo;
}
void populateVersionsForVlm(String vlmId, Version vlmVersion) {
VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
- versioningManager.list(vlmId).stream().filter(version -> version.getId().equalsIgnoreCase(vlmVersion.getId()))
- .findAny().ifPresent(version -> {
- vlmVersion.setMinor(version.getMinor());
- vlmVersion.setMajor(version.getMajor());
- });
+ versioningManager.list(vlmId).stream().filter(version -> version.getId().equalsIgnoreCase(vlmVersion.getId())).findAny()
+ .ifPresent(version -> {
+ vlmVersion.setMinor(version.getMinor());
+ vlmVersion.setMajor(version.getMajor());
+ });
}
private PackageInfo createPackageInfo(VspDetails vspDetails) {
@@ -646,14 +581,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
-
public QuestionnaireResponse getVspQuestionnaire(String vspId, Version version) {
VspQuestionnaireEntity retrieved = vspInfoDao.getQuestionnaire(vspId, version);
- VersioningUtil
- .validateEntityExistence(retrieved, new VspQuestionnaireEntity(vspId, version), VspDetails.ENTITY_TYPE);
-
+ VersioningUtil.validateEntityExistence(retrieved, new VspQuestionnaireEntity(vspId, version), VspDetails.ENTITY_TYPE);
String questionnaireData = retrieved.getQuestionnaireData();
-
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
questionnaireResponse.setData(questionnaireData);
questionnaireResponse.setSchema(getVspQuestionnaireSchema(null));
@@ -665,45 +596,34 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData);
}
-
- private Map<String, List<ErrorMessage>> validateOrchestrationTemplate(
- OrchestrationTemplateEntity orchestrationTemplate) throws IOException {
-
+ private Map<String, List<ErrorMessage>> validateOrchestrationTemplate(OrchestrationTemplateEntity orchestrationTemplate) throws IOException {
if (isOrchestrationTemplateMissing(orchestrationTemplate)) {
return null;
}
Map<String, List<ErrorMessage>> validationErrors = new HashMap<>();
-
- FileContentHandler fileContentMap = CommonUtil.validateAndUploadFileContent(
- OnboardingTypesEnum.getOnboardingTypesEnum(orchestrationTemplate.getFileSuffix()),
+ FileContentHandler fileContentMap = CommonUtil
+ .validateAndUploadFileContent(OnboardingTypesEnum.getOnboardingTypesEnum(orchestrationTemplate.getFileSuffix()),
orchestrationTemplate.getContentData().array());
-
try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
addDummyHeatBase(zipFileManifest, fileContentMap);
} catch (Exception e) {
LOGGER.error("Invalid package content", e);
}
-
if (CommonUtil.isFileOriginFromZip(orchestrationTemplate.getFileSuffix())) {
ValidationManager validationManager = ValidationManagerUtil.initValidationManager(fileContentMap);
validationErrors.putAll(validationManager.validate());
}
-
- return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) ? null
- : validationErrors;
+ return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) ? null : validationErrors;
}
private FileContentHandler addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
- ManifestContent manifestContent =
- JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
+ ManifestContent manifestContent = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
for (FileData fileData : manifestContent.getData()) {
if ((fileData.getFile()).contains("dummy_ignore.yaml")) {
String filePath = new File("").getAbsolutePath() + "/resources";
File envFilePath = new File(filePath + "/base_template.env");
File baseFilePath = new File(filePath + "/base_template.yaml");
- try (
- InputStream envStream = new FileInputStream(envFilePath);
- InputStream baseStream = new FileInputStream(baseFilePath);) {
+ try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath);) {
fileContentMap.addFile("base_template_dummy_ignore.env", envStream);
fileContentMap.addFile("base_template_dummy_ignore.yaml", baseStream);
} catch (Exception e) {
@@ -713,44 +633,34 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
return fileContentMap;
}
- private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version,
- String onboardingMethod) {
+
+ private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version, String onboardingMethod) {
// The apis of CompositionEntityDataManager used here are stateful!
+
// so, it must be re-created from scratch when it is used!
- CompositionEntityDataManager compositionEntityDataManager =
- CompositionEntityDataManagerFactory.getInstance().createInterface();
+ CompositionEntityDataManager compositionEntityDataManager = CompositionEntityDataManagerFactory.getInstance().createInterface();
compositionEntityDataManager.addEntity(vspInfoDao.getQuestionnaire(vspId, version), null);
-
Collection<NicEntity> nics = nicDao.listByVsp(vspId, version);
-
Map<String, List<String>> nicNamesByComponent = new HashMap<>();
for (NicEntity nicEntity : nics) {
compositionEntityDataManager.addEntity(nicEntity, null);
-
Nic nic = nicEntity.getNicCompositionData();
if (nic != null && nic.getName() != null) {
- List<String> nicNames =
- nicNamesByComponent.computeIfAbsent(nicEntity.getComponentId(), k -> new ArrayList<>());
+ List<String> nicNames = nicNamesByComponent.computeIfAbsent(nicEntity.getComponentId(), k -> new ArrayList<>());
nicNames.add(nic.getName());
}
}
-
Collection<ComponentEntity> components = componentDao.listCompositionAndQuestionnaire(vspId, version);
components.forEach(component -> compositionEntityDataManager.addEntity(component,
- new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()),
- JsonUtil.json2Object(component.getQuestionnaireData(), Map.class), null,
- OnboardingMethod.Manual.name().equals(onboardingMethod))));
-
+ new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()),
+ JsonUtil.json2Object(component.getQuestionnaireData(), Map.class), null, OnboardingMethod.Manual.name().equals(onboardingMethod))));
Collection<ComputeEntity> computes = computeDao.listByVsp(vspId, version);
computes.forEach(compute -> compositionEntityDataManager.addEntity(compute, null));
-
if (OnboardingMethod.Manual.name().equals(onboardingMethod)) {
Collection<ImageEntity> images = imageDao.listByVsp(vspId, version);
images.forEach(image -> compositionEntityDataManager.addEntity(image, null));
}
-
- Map<CompositionEntityId, Collection<String>> errorsByEntityId =
- compositionEntityDataManager.validateEntitiesQuestionnaire();
+ Map<CompositionEntityId, Collection<String>> errorsByEntityId = compositionEntityDataManager.validateEntitiesQuestionnaire();
if (MapUtils.isNotEmpty(errorsByEntityId)) {
compositionEntityDataManager.buildTrees();
compositionEntityDataManager.addErrorsToTrees(errorsByEntityId);
@@ -762,24 +672,18 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public File getInformationArtifact(String vspId, Version version) {
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
-
if (vspDetails == null) {
return null;
}
-
String vspName = vspDetails.getName();
ByteBuffer infoArtifactAsByteBuffer;
File infoArtifactFile;
try {
- infoArtifactAsByteBuffer =
- ByteBuffer.wrap(informationArtifactGenerator.generate(vspId, version).getBytes());
-
- infoArtifactFile =
- new File(String.format(VendorSoftwareProductConstants.INFORMATION_ARTIFACT_NAME, vspName));
+ infoArtifactAsByteBuffer = ByteBuffer.wrap(informationArtifactGenerator.generate(vspId, version).getBytes());
+ infoArtifactFile = new File(String.format(VendorSoftwareProductConstants.INFORMATION_ARTIFACT_NAME, vspName));
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(infoArtifactFile))) {
out.write(infoArtifactAsByteBuffer.array());
}
-
} catch (IOException ex) {
throw new CoreException(new InformationArtifactCreationErrorBuilder(vspId).build(), ex);
}
@@ -792,25 +696,19 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
-
OrchestrationTemplateEntity orchestrationTemplateEntity = orchestrationTemplateDao.get(vspId, version);
-
if (isOrchestrationTemplateMissing(orchestrationTemplateEntity)) {
return Optional.empty();
}
-
if (CommonUtil.isFileOriginFromZip(orchestrationTemplateEntity.getFileSuffix())) {
return Optional.of(new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(),
- candidateService.getZipData(orchestrationTemplateEntity.getContentData())));
+ candidateService.getZipData(orchestrationTemplateEntity.getContentData())));
}
- return Optional.of(new ImmutablePair<>(orchestrationTemplateEntity.getFileSuffix(),
- orchestrationTemplateEntity.getContentData().array()));
+ return Optional.of(new ImmutablePair<>(orchestrationTemplateEntity.getFileSuffix(), orchestrationTemplateEntity.getContentData().array()));
}
void updateUniqueName(String oldVspName, String newVspName) {
- uniqueValueUtil
- .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, oldVspName,
- newVspName);
+ uniqueValueUtil.updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, oldVspName, newVspName);
}
@Override
@@ -819,8 +717,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
private boolean isOrchestrationTemplateMissing(OrchestrationTemplateEntity orchestrationTemplate) {
- return orchestrationTemplate == null || orchestrationTemplate.getContentData() == null
- || orchestrationTemplate.getFileSuffix() == null || orchestrationTemplate.getFileName() == null;
+ return orchestrationTemplate == null || orchestrationTemplate.getContentData() == null || orchestrationTemplate.getFileSuffix() == null
+ || orchestrationTemplate.getFileName() == null;
}
private boolean isServiceModelMissing(ToscaServiceModel serviceModel) {
@@ -859,8 +757,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return this;
}
- public Builder orchestrationTemplateCandidateManager(
- OrchestrationTemplateCandidateManager orchestrationTemplateCandidateManager) {
+ public Builder orchestrationTemplateCandidateManager(OrchestrationTemplateCandidateManager orchestrationTemplateCandidateManager) {
this.orchestrationTemplateCandidateManager = orchestrationTemplateCandidateManager;
return this;
}
@@ -880,8 +777,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return this;
}
- public Builder enrichedServiceModel(
- EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao) {
+ public Builder enrichedServiceModel(EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao) {
this.enrichedServiceModelDao = enrichedServiceModelDao;
return this;
}
@@ -948,12 +844,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private void registerToVersioning() {
if (serviceModelDao != null) {
- serviceModelDao
- .registerVersioning(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
+ serviceModelDao.registerVersioning(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
}
if (enrichedServiceModelDao != null) {
- enrichedServiceModelDao
- .registerVersioning(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
+ enrichedServiceModelDao.registerVersioning(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
}
}
@@ -961,8 +855,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
VendorSoftwareProductManagerImpl vendorSoftwareProductManager = new VendorSoftwareProductManagerImpl();
vendorSoftwareProductManager.vspMergeDao = this.vspMergeDao;
vendorSoftwareProductManager.orchestrationTemplateDao = this.orchestrationTemplateDao;
- vendorSoftwareProductManager.orchestrationTemplateCandidateManager =
- this.orchestrationTemplateCandidateManager;
+ vendorSoftwareProductManager.orchestrationTemplateCandidateManager = this.orchestrationTemplateCandidateManager;
vendorSoftwareProductManager.vspInfoDao = this.vspInfoDao;
vendorSoftwareProductManager.vendorLicenseFacade = this.vendorLicenseFacade;
vendorSoftwareProductManager.serviceModelDao = this.serviceModelDao;
@@ -983,5 +876,4 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return vendorSoftwareProductManager;
}
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
index a504f35026..177bd79b30 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.core.dao.UniqueValueDaoFactory;
@@ -38,30 +37,27 @@ import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory;
public class VspManagerFactoryImpl extends VspManagerFactory {
- private static final VendorSoftwareProductManager INSTANCE = new VendorSoftwareProductManagerImpl.Builder()
- .vspMerge(VspMergeDaoFactory.getInstance().createInterface())
- .orchestrationTemplate(OrchestrationTemplateDaoFactory.getInstance().createInterface())
- .orchestrationTemplateCandidateManager(OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface())
- .vspInfo(VendorSoftwareProductInfoDaoFactory.getInstance().createInterface())
- .vendorLicenseFacade(VendorLicenseFacadeFactory.getInstance().createInterface())
- .serviceModel(ServiceModelDaoFactory.getInstance().createInterface())
- .enrichedServiceModel(EnrichedServiceModelDaoFactory.getInstance().createInterface())
- .licenseArtifactsService(VendorLicenseArtifactServiceFactory.getInstance().createInterface())
- .informationArtifactGenerator(InformationArtifactGeneratorFactory.getInstance().createInterface())
- .packageInfo(PackageInfoDaoFactory.getInstance().createInterface())
- .deploymentFlavor(DeploymentFlavorDaoFactory.getInstance().createInterface())
- .component(ComponentDaoFactory.getInstance().createInterface())
- .componentDependencyModel(ComponentDependencyModelDaoFactory.getInstance().createInterface())
- .nic(NicDaoFactory.getInstance().createInterface())
- .compute(ComputeDaoFactory.getInstance().createInterface())
- .image(ImageDaoFactory.getInstance().createInterface())
- .manualVspToscaManager(new ManualVspToscaManagerImpl())
- .uniqueValue(UniqueValueDaoFactory.getInstance().createInterface())
- .candidateService(CandidateServiceFactory.getInstance().createInterface())
- .build();
- @Override
- public VendorSoftwareProductManager createInterface() {
- return INSTANCE;
- }
+ private static final VendorSoftwareProductManager INSTANCE = new VendorSoftwareProductManagerImpl.Builder()
+ .vspMerge(VspMergeDaoFactory.getInstance().createInterface())
+ .orchestrationTemplate(OrchestrationTemplateDaoFactory.getInstance().createInterface())
+ .orchestrationTemplateCandidateManager(OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface())
+ .vspInfo(VendorSoftwareProductInfoDaoFactory.getInstance().createInterface())
+ .vendorLicenseFacade(VendorLicenseFacadeFactory.getInstance().createInterface())
+ .serviceModel(ServiceModelDaoFactory.getInstance().createInterface())
+ .enrichedServiceModel(EnrichedServiceModelDaoFactory.getInstance().createInterface())
+ .licenseArtifactsService(VendorLicenseArtifactServiceFactory.getInstance().createInterface())
+ .informationArtifactGenerator(InformationArtifactGeneratorFactory.getInstance().createInterface())
+ .packageInfo(PackageInfoDaoFactory.getInstance().createInterface())
+ .deploymentFlavor(DeploymentFlavorDaoFactory.getInstance().createInterface()).component(ComponentDaoFactory.getInstance().createInterface())
+ .componentDependencyModel(ComponentDependencyModelDaoFactory.getInstance().createInterface())
+ .nic(NicDaoFactory.getInstance().createInterface()).compute(ComputeDaoFactory.getInstance().createInterface())
+ .image(ImageDaoFactory.getInstance().createInterface()).manualVspToscaManager(new ManualVspToscaManagerImpl())
+ .uniqueValue(UniqueValueDaoFactory.getInstance().createInterface()).candidateService(CandidateServiceFactory.getInstance().createInterface())
+ .build();
+
+ @Override
+ public VendorSoftwareProductManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/ManifestAnalyzer.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/ManifestAnalyzer.java
index ecb3ac62ed..e3a82e1602 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/ManifestAnalyzer.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/ManifestAnalyzer.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding;
import java.util.ArrayList;
@@ -29,11 +28,9 @@ import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
public class ManifestAnalyzer {
- private final ManifestContent manifest;
-
private final static Set<Type> HEAT_TYPES = Collections.singleton(Type.HEAT);
-
private final static Set<Type> HELM_TYPES = Collections.singleton(Type.HELM);
+ private final ManifestContent manifest;
public ManifestAnalyzer(ManifestContent manifest) {
this.manifest = manifest;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageContentHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageContentHandler.java
index c519802568..056d4e1a55 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageContentHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageContentHandler.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding;
import java.util.HashMap;
@@ -37,17 +36,12 @@ public class OnboardingPackageContentHandler extends FileContentHandler {
public Map<String, String> getFileAndSignaturePathMap(final Set<String> signatureExtensionSet) {
final Map<String, byte[]> files = getFiles();
final Map<String, String> signedFilePairMap = new HashMap<>();
- files.keySet().stream()
- .filter(filePath -> !signatureExtensionSet.contains(FilenameUtils.getExtension(filePath)))
- .forEach(filePath -> {
- final String filePathWithoutExtension = FilenameUtils.removeExtension(filePath);
- signatureExtensionSet.stream()
- .map(extension -> String.format("%s.%s", filePathWithoutExtension, extension))
- .filter(files::containsKey)
- .forEach(file -> signedFilePairMap.put(filePath, file));
- signedFilePairMap.putIfAbsent(filePath, null);
- });
+ files.keySet().stream().filter(filePath -> !signatureExtensionSet.contains(FilenameUtils.getExtension(filePath))).forEach(filePath -> {
+ final String filePathWithoutExtension = FilenameUtils.removeExtension(filePath);
+ signatureExtensionSet.stream().map(extension -> String.format("%s.%s", filePathWithoutExtension, extension)).filter(files::containsKey)
+ .forEach(file -> signedFilePairMap.put(filePath, file));
+ signedFilePairMap.putIfAbsent(filePath, null);
+ });
return signedFilePairMap;
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java
index e863f34696..640a15735f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java
@@ -17,7 +17,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding;
import static org.openecomp.sdc.common.errors.Messages.COULD_NOT_READ_MANIFEST_FILE;
@@ -69,13 +68,12 @@ public class OnboardingPackageProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingPackageProcessor.class);
private static final String CSAR_EXTENSION = "csar";
private static final String ZIP_EXTENSION = "zip";
-
private final String packageFileName;
private final byte[] packageFileContent;
- private FileContentHandler packageContent;
private final Set<ErrorMessage> errorMessages = new HashSet<>();
private final OnboardPackageInfo onboardPackageInfo;
private final CnfPackageValidator cnfPackageValidator;
+ private FileContentHandler packageContent;
public OnboardingPackageProcessor(final String packageFileName, final byte[] packageFileContent) {
this.packageFileName = packageFileName;
@@ -106,7 +104,6 @@ public class OnboardingPackageProcessor {
if (hasNoErrors()) {
final String packageName = FilenameUtils.getBaseName(packageFileName);
final String packageExtension = FilenameUtils.getExtension(packageFileName);
-
if (hasSignedPackageStructure()) {
packageInfo = processSignedPackage(packageName, packageExtension);
} else {
@@ -122,8 +119,7 @@ public class OnboardingPackageProcessor {
private void validateFile() {
if (!hasValidExtension()) {
- String message = PACKAGE_INVALID_EXTENSION
- .formatMessage(packageFileName, String.join(", ", CSAR_EXTENSION, ZIP_EXTENSION));
+ String message = PACKAGE_INVALID_EXTENSION.formatMessage(packageFileName, String.join(", ", CSAR_EXTENSION, ZIP_EXTENSION));
reportError(ErrorLevel.ERROR, message);
} else {
try {
@@ -141,8 +137,8 @@ public class OnboardingPackageProcessor {
}
private OnboardPackageInfo processCsarPackage(String packageName, String packageExtension) {
- OnboardPackage onboardPackage = new OnboardPackage(packageName, packageExtension,
- ByteBuffer.wrap(packageFileContent), new OnboardingPackageContentHandler(packageContent));
+ OnboardPackage onboardPackage = new OnboardPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent),
+ new OnboardingPackageContentHandler(packageContent));
return new OnboardPackageInfo(onboardPackage, OnboardingTypesEnum.CSAR);
}
@@ -151,15 +147,14 @@ public class OnboardingPackageProcessor {
if (manifest != null) {
List<String> errors = validateZipPackage(manifest);
if (errors.isEmpty()) {
- final OnboardPackage onboardPackage = new OnboardPackage(packageName, packageExtension,
- ByteBuffer.wrap(packageFileContent), packageContent);
+ final OnboardPackage onboardPackage = new OnboardPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent),
+ packageContent);
return new OnboardPackageInfo(onboardPackage, OnboardingTypesEnum.ZIP);
} else {
errors.forEach(message -> reportError(ErrorLevel.ERROR, message));
}
} else {
- reportError(ErrorLevel.ERROR,
- COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName));
+ reportError(ErrorLevel.ERROR, COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName));
}
return null;
}
@@ -184,7 +179,6 @@ public class OnboardingPackageProcessor {
ManifestContent manifest = null;
try (InputStream zipFileManifest = packageContent.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
manifest = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
-
} catch (Exception e) {
final String message = COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName);
LOGGER.error(message, e);
@@ -198,8 +192,7 @@ public class OnboardingPackageProcessor {
try {
boolean heatBase = false;
for (FileData fileData : manifestContent.getData()) {
- if (Objects.nonNull(fileData.getType()) &&
- fileData.getType().equals(FileData.Type.HELM) && fileData.getBase()) {
+ if (Objects.nonNull(fileData.getType()) && fileData.getType().equals(FileData.Type.HELM) && fileData.getBase()) {
heatBase = true;
fileData.setBase(false);
FileData dummyHeat = new FileData();
@@ -217,8 +210,7 @@ public class OnboardingPackageProcessor {
String filePath = new File("").getAbsolutePath() + "/resources";
File envFilePath = new File(filePath + "/base_template.env");
File baseFilePath = new File(filePath + "/base_template.yaml");
- try (InputStream envStream = new FileInputStream(envFilePath);
- InputStream baseStream = new FileInputStream(baseFilePath)) {
+ try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath)) {
packageContent.addFile("base_template_dummy_ignore.env", envStream);
packageContent.addFile("base_template_dummy_ignore.yaml", baseStream);
} catch (Exception e) {
@@ -252,27 +244,23 @@ public class OnboardingPackageProcessor {
}
final String signatureFilePath = findSignatureFilePath().orElse(null);
final String certificateFilePath = findCertificateFilePath().orElse(null);
- final OnboardSignedPackage onboardSignedPackage =
- new OnboardSignedPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent),
- packageContent, signatureFilePath, internalPackagePath, certificateFilePath);
-
+ final OnboardSignedPackage onboardSignedPackage = new OnboardSignedPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent),
+ packageContent, signatureFilePath, internalPackagePath, certificateFilePath);
final String internalPackageName = FilenameUtils.getName(internalPackagePath);
final String internalPackageBaseName = FilenameUtils.getBaseName(internalPackagePath);
final String internalPackageExtension = FilenameUtils.getExtension(internalPackagePath);
final byte[] internalPackageContent = packageContent.getFileContent(internalPackagePath);
final OnboardPackage onboardPackage;
try {
- final OnboardingPackageContentHandler fileContentHandler =
- new OnboardingPackageContentHandler(CommonUtil.getZipContent(internalPackageContent));
- onboardPackage = new OnboardPackage(internalPackageBaseName, internalPackageExtension,
- internalPackageContent, fileContentHandler);
+ final OnboardingPackageContentHandler fileContentHandler = new OnboardingPackageContentHandler(
+ CommonUtil.getZipContent(internalPackageContent));
+ onboardPackage = new OnboardPackage(internalPackageBaseName, internalPackageExtension, internalPackageContent, fileContentHandler);
} catch (final ZipException e) {
final String message = PACKAGE_PROCESS_INTERNAL_PACKAGE_ERROR.formatMessage(internalPackageName);
LOGGER.error(message, e);
reportError(ErrorLevel.ERROR, message);
return null;
}
-
return new OnboardPackageInfo(onboardSignedPackage, onboardPackage, OnboardingTypesEnum.SIGNED_CSAR);
}
@@ -281,13 +269,10 @@ public class OnboardingPackageProcessor {
}
private Optional<String> findInternalPackagePath() {
- return packageContent.getFileList().stream()
- .filter(filePath -> {
- final String extension = FilenameUtils.getExtension(filePath);
- return CSAR_EXTENSION.equalsIgnoreCase(extension) || ZIP_EXTENSION.equalsIgnoreCase(extension);
- }
- )
- .findFirst();
+ return packageContent.getFileList().stream().filter(filePath -> {
+ final String extension = FilenameUtils.getExtension(filePath);
+ return CSAR_EXTENSION.equalsIgnoreCase(extension) || ZIP_EXTENSION.equalsIgnoreCase(extension);
+ }).findFirst();
}
private boolean isPackageEmpty() {
@@ -295,60 +280,43 @@ public class OnboardingPackageProcessor {
}
private boolean hasSignedPackageStructure() {
- if (MapUtils.isEmpty(packageContent.getFiles()) || !CollectionUtils.isEmpty(
- packageContent.getFolderList())) {
+ if (MapUtils.isEmpty(packageContent.getFiles()) || !CollectionUtils.isEmpty(packageContent.getFolderList())) {
return false;
}
final int numberOfFiles = packageContent.getFileList().size();
if (numberOfFiles == 2) {
- return hasOneInternalPackageFile(packageContent) &&
- hasOneSignatureFile(packageContent);
+ return hasOneInternalPackageFile(packageContent) && hasOneSignatureFile(packageContent);
}
-
if (numberOfFiles == 3) {
- return hasOneInternalPackageFile(packageContent) &&
- hasOneSignatureFile(packageContent) &&
- hasOneCertificateFile(packageContent);
+ return hasOneInternalPackageFile(packageContent) && hasOneSignatureFile(packageContent) && hasOneCertificateFile(packageContent);
}
-
return false;
}
private boolean hasOneInternalPackageFile(final FileContentHandler fileContentHandler) {
- return fileContentHandler.getFileList().parallelStream()
- .map(FilenameUtils::getExtension)
- .map(String::toLowerCase)
+ return fileContentHandler.getFileList().parallelStream().map(FilenameUtils::getExtension).map(String::toLowerCase)
.filter(file -> file.endsWith(CSAR_EXTENSION)).count() == 1;
}
private boolean hasOneSignatureFile(final FileContentHandler fileContentHandler) {
- return fileContentHandler.getFileList().parallelStream()
- .map(FilenameUtils::getExtension)
- .map(String::toLowerCase)
+ return fileContentHandler.getFileList().parallelStream().map(FilenameUtils::getExtension).map(String::toLowerCase)
.filter(ALLOWED_SIGNATURE_EXTENSIONS::contains).count() == 1;
}
private boolean hasOneCertificateFile(final FileContentHandler fileContentHandler) {
- return fileContentHandler.getFileList().parallelStream()
- .map(FilenameUtils::getExtension)
- .map(String::toLowerCase)
+ return fileContentHandler.getFileList().parallelStream().map(FilenameUtils::getExtension).map(String::toLowerCase)
.filter(ALLOWED_CERTIFICATE_EXTENSIONS::contains).count() == 1;
}
private Optional<String> findSignatureFilePath() {
final Map<String, byte[]> files = packageContent.getFiles();
- return files.keySet().stream()
- .filter(
- fileName -> ALLOWED_SIGNATURE_EXTENSIONS.contains(FilenameUtils.getExtension(fileName).toLowerCase()))
+ return files.keySet().stream().filter(fileName -> ALLOWED_SIGNATURE_EXTENSIONS.contains(FilenameUtils.getExtension(fileName).toLowerCase()))
.findFirst();
}
private Optional<String> findCertificateFilePath() {
final Map<String, byte[]> files = packageContent.getFiles();
- return files.keySet().stream()
- .filter(
- fileName -> ALLOWED_CERTIFICATE_EXTENSIONS.contains(FilenameUtils.getExtension(fileName).toLowerCase()))
+ return files.keySet().stream().filter(fileName -> ALLOWED_CERTIFICATE_EXTENSIONS.contains(FilenameUtils.getExtension(fileName).toLowerCase()))
.findFirst();
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java
index 8520672cd3..50f1fd8d06 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.validation;
import static org.openecomp.sdc.common.errors.Messages.MANIFEST_VALIDATION_HELM_IS_BASE_MISSING;
@@ -32,12 +31,10 @@ public class CnfPackageValidator {
public List<String> validateHelmPackage(List<FileData> modules) {
List<String> messages = Collections.emptyList();
-
if (modules != null && !modules.isEmpty()) {
Stats stats = calculateStats(modules);
messages = createErrorMessages(stats);
}
-
return messages;
}
@@ -55,17 +52,14 @@ public class CnfPackageValidator {
private List<String> createErrorMessages(Stats stats) {
List<String> messages = new ArrayList<>();
-
if (stats.without > 0) {
messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_MISSING.formatMessage(stats.without));
}
-
if (stats.base == 0) {
messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_NOT_SET.getErrorMessage());
} else if (stats.base > 1) {
messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_NOT_UNIQUE.getErrorMessage());
}
-
return messages;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java
index 68309106cd..6e810eefbd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
import java.io.ByteArrayInputStream;
@@ -35,73 +34,60 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
public abstract class BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler {
- protected static final Logger logger = LoggerFactory.getLogger(BaseOrchestrationTemplateHandler.class);
-
- @Override
- public UploadFileResponse upload(final VspDetails vspDetails,
- final OnboardPackageInfo onboardPackageInfo,
- final CandidateService candidateService) {
- final OnboardPackage onboardPackage = onboardPackageInfo.getOnboardPackage();
- final UploadFileResponse uploadFileResponse = new UploadFileResponse();
- uploadFileResponse.setOnboardingType(getHandlerType());
- if (isFileToUploadEmpty(onboardPackage, uploadFileResponse, candidateService)) {
- return uploadFileResponse;
- }
-
- final byte[] fileContentByteArray = onboardPackage.getFileContent().array();
- if (isInvalidRawZipData(onboardPackage.getFileExtension(),
- uploadFileResponse, fileContentByteArray, candidateService)) {
- return uploadFileResponse;
- }
-
- final UploadFileResponse validateResponse = validate(onboardPackageInfo);
- if (!MapUtils.isEmpty(validateResponse.getErrors())) {
- uploadFileResponse.addStructureErrors(validateResponse.getErrors());
- return uploadFileResponse;
- }
+ protected static final Logger logger = LoggerFactory.getLogger(BaseOrchestrationTemplateHandler.class);
- final UploadFileResponse responseFromUpdate = updateCandidateData(vspDetails, onboardPackageInfo,
- candidateService);
- if (!MapUtils.isEmpty(responseFromUpdate.getErrors())) {
- uploadFileResponse.addStructureErrors(responseFromUpdate.getErrors());
+ @Override
+ public UploadFileResponse upload(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo,
+ final CandidateService candidateService) {
+ final OnboardPackage onboardPackage = onboardPackageInfo.getOnboardPackage();
+ final UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ uploadFileResponse.setOnboardingType(getHandlerType());
+ if (isFileToUploadEmpty(onboardPackage, uploadFileResponse, candidateService)) {
+ return uploadFileResponse;
+ }
+ final byte[] fileContentByteArray = onboardPackage.getFileContent().array();
+ if (isInvalidRawZipData(onboardPackage.getFileExtension(), uploadFileResponse, fileContentByteArray, candidateService)) {
+ return uploadFileResponse;
+ }
+ final UploadFileResponse validateResponse = validate(onboardPackageInfo);
+ if (!MapUtils.isEmpty(validateResponse.getErrors())) {
+ uploadFileResponse.addStructureErrors(validateResponse.getErrors());
+ return uploadFileResponse;
+ }
+ final UploadFileResponse responseFromUpdate = updateCandidateData(vspDetails, onboardPackageInfo, candidateService);
+ if (!MapUtils.isEmpty(responseFromUpdate.getErrors())) {
+ uploadFileResponse.addStructureErrors(responseFromUpdate.getErrors());
+ }
+ return uploadFileResponse;
}
- return uploadFileResponse;
- }
-
- protected abstract UploadFileResponse updateCandidateData(final VspDetails vspDetails,
- final OnboardPackageInfo onboardPackageInfo,
- final CandidateService candidateService);
+ protected abstract UploadFileResponse updateCandidateData(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo,
+ final CandidateService candidateService);
- private boolean isFileToUploadEmpty(final OnboardPackage onboardPackage,
- final UploadFileResponse uploadFileResponse,
- final CandidateService candidateService) {
- final ByteArrayInputStream fileToUpload = new ByteArrayInputStream(
- onboardPackage.getFileContent().array());
- Optional<ErrorMessage> errorMessage =
- candidateService.validateNonEmptyFileToUpload(fileToUpload, onboardPackage.getFileExtension());
- if (errorMessage.isPresent()) {
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
- return true;
+ private boolean isFileToUploadEmpty(final OnboardPackage onboardPackage, final UploadFileResponse uploadFileResponse,
+ final CandidateService candidateService) {
+ final ByteArrayInputStream fileToUpload = new ByteArrayInputStream(onboardPackage.getFileContent().array());
+ Optional<ErrorMessage> errorMessage = candidateService.validateNonEmptyFileToUpload(fileToUpload, onboardPackage.getFileExtension());
+ if (errorMessage.isPresent()) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
+ return true;
+ }
+ return false;
}
- return false;
- }
- protected boolean isInvalidRawZipData(String fileSuffix,
- UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData,
- CandidateService candidateService) {
- Optional<ErrorMessage> errorMessage;
- errorMessage = candidateService.validateRawZipData(fileSuffix, uploadedFileData);
- if (errorMessage.isPresent()) {
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
- return true;
+ protected boolean isInvalidRawZipData(String fileSuffix, UploadFileResponse uploadFileResponse, byte[] uploadedFileData,
+ CandidateService candidateService) {
+ Optional<ErrorMessage> errorMessage;
+ errorMessage = candidateService.validateRawZipData(fileSuffix, uploadedFileData);
+ if (errorMessage.isPresent()) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
+ return true;
+ }
+ return false;
}
- return false;
- }
- public abstract UploadFileResponse validate(final OnboardPackageInfo onboardPackageInfo);
+ public abstract UploadFileResponse validate(final OnboardPackageInfo onboardPackageInfo);
- protected abstract OnboardingTypesEnum getHandlerType();
+ protected abstract OnboardingTypesEnum getHandlerType();
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
index 94638a5876..e7367c2a49 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2018 AT&T Intellectual Property.
- * Modifications Copyright (c) 2018 Verizon Property.
- * Modifications Copyright (c) 2019 Nordix Foundation.
+ * Modifications Copyright (c) 2018 Verizon Property.
+ * Modifications Copyright (c) 2019 Nordix Foundation.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
@@ -43,42 +42,35 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardSignedPackage;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
-public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler
- implements OrchestrationTemplateFileHandler {
+public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler {
@Override
public UploadFileResponse validate(final OnboardPackageInfo onboardPackageInfo) {
final UploadFileResponse uploadFileResponse = new UploadFileResponse();
if (onboardPackageInfo.getPackageType() == OnboardingTypesEnum.SIGNED_CSAR) {
- final OnboardSignedPackage originalOnboardPackage =
- (OnboardSignedPackage) onboardPackageInfo.getOriginalOnboardPackage();
+ final OnboardSignedPackage originalOnboardPackage = (OnboardSignedPackage) onboardPackageInfo.getOriginalOnboardPackage();
validatePackageSecurity(originalOnboardPackage).ifPresent(packageSignatureResponse -> {
if (packageSignatureResponse.hasErrors()) {
uploadFileResponse.addStructureErrors(packageSignatureResponse.getErrors());
}
});
-
if (uploadFileResponse.hasErrors()) {
return uploadFileResponse;
}
}
final OnboardPackage onboardPackage = onboardPackageInfo.getOnboardPackage();
final FileContentHandler fileContentHandler = onboardPackage.getFileContentHandler();
-
try {
final Validator validator = ValidatorFactory.getValidator(fileContentHandler);
uploadFileResponse.addStructureErrors(validator.validateContent(fileContentHandler));
} catch (IOException exception) {
logger.error(exception.getMessage(), exception);
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_CSAR_FILE.getErrorMessage()));
+ uploadFileResponse
+ .addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_CSAR_FILE.getErrorMessage()));
} catch (CoreException coreException) {
logger.error(coreException.getMessage(), coreException);
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
}
-
return uploadFileResponse;
}
@@ -87,8 +79,7 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
try {
final CsarSecurityValidator csarSecurityValidator = new CsarSecurityValidator();
if (!csarSecurityValidator.verifyPackageSignature(originalOnboardPackage)) {
- final ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.ERROR,
- Messages.FAILED_TO_VERIFY_SIGNATURE.getErrorMessage());
+ final ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.ERROR, Messages.FAILED_TO_VERIFY_SIGNATURE.getErrorMessage());
logger.error(errorMessage.getMessage());
uploadFileResponseDto.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage);
return Optional.of(uploadFileResponseDto);
@@ -103,31 +94,24 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
}
@Override
- protected UploadFileResponse updateCandidateData(final VspDetails vspDetails,
- final OnboardPackageInfo onboardPackageInfo,
+ protected UploadFileResponse updateCandidateData(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo,
final CandidateService candidateService) {
final UploadFileResponse uploadFileResponse = new UploadFileResponse();
final OnboardPackage csarPackage = onboardPackageInfo.getOnboardPackage();
final OnboardPackage originalOnboardPackage = onboardPackageInfo.getOriginalOnboardPackage();
try {
candidateService.updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(),
- new OrchestrationTemplateCandidateData(csarPackage.getFileContent(),
- "", csarPackage.getFileExtension(),
- csarPackage.getFilename(), originalOnboardPackage.getFilename(),
- originalOnboardPackage.getFileExtension(),
- originalOnboardPackage.getFileContent()));
+ new OrchestrationTemplateCandidateData(csarPackage.getFileContent(), "", csarPackage.getFileExtension(), csarPackage.getFilename(),
+ originalOnboardPackage.getFilename(), originalOnboardPackage.getFileExtension(), originalOnboardPackage.getFileContent()));
} catch (final Exception exception) {
- logger.error(getErrorWithParameters(Messages.FILE_LOAD_CONTENT_ERROR.getErrorMessage(),
- getHandlerType().toString()), exception);
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+ logger.error(getErrorWithParameters(Messages.FILE_LOAD_CONTENT_ERROR.getErrorMessage(), getHandlerType().toString()), exception);
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
}
return uploadFileResponse;
}
- @Override
- protected OnboardingTypesEnum getHandlerType() {
- return OnboardingTypesEnum.CSAR;
- }
-
+ @Override
+ protected OnboardingTypesEnum getHandlerType() {
+ return OnboardingTypesEnum.CSAR;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java
index 2d2f1ae92b..9bd1b2ea22 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
@@ -24,7 +23,5 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
@FunctionalInterface
public interface OrchestrationTemplateFileHandler {
- UploadFileResponse upload(final VspDetails vspDetails,
- final OnboardPackageInfo onboardPackageInfo,
- final CandidateService candidateService);
+ UploadFileResponse upload(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo, final CandidateService candidateService);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java
index 3e54260e8b..65ce2f5397 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
@@ -35,44 +34,37 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackage;
import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
-public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHandler
- implements OrchestrationTemplateFileHandler {
+public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler {
@Override
public UploadFileResponse validate(final OnboardPackageInfo onboardPackageInfo) {
final UploadFileResponse uploadFileResponse = new UploadFileResponse();
final OnboardPackage onboardPackage = onboardPackageInfo.getOnboardPackage();
- OrchestrationUtil
- .getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, onboardPackage.getFileContent().array());
+ OrchestrationUtil.getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, onboardPackage.getFileContent().array());
return uploadFileResponse;
}
- @Override
- protected UploadFileResponse updateCandidateData(final VspDetails vspDetails,
- final OnboardPackageInfo onboardPackageInfo,
- final CandidateService candidateService) {
- final UploadFileResponse uploadFileResponse = new UploadFileResponse();
- try {
- final OnboardPackage zipPackage = onboardPackageInfo.getOnboardPackage();
- final OrchestrationTemplateCandidateData candidateData =
- new CandidateEntityBuilder(candidateService)
- .buildCandidateEntityFromZip(vspDetails, zipPackage.getFileContent().array(), zipPackage.getFileContentHandler(),
- uploadFileResponse.getErrors());
- candidateData.setFileName(zipPackage.getFilename());
- candidateData.setFileSuffix(zipPackage.getFileExtension());
- candidateService
- .updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(), candidateData);
- } catch (final Exception exception) {
- logger.error(getErrorWithParameters(Messages.FILE_LOAD_CONTENT_ERROR.getErrorMessage(),
- getHandlerType().toString()), exception);
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+ @Override
+ protected UploadFileResponse updateCandidateData(final VspDetails vspDetails, final OnboardPackageInfo onboardPackageInfo,
+ final CandidateService candidateService) {
+ final UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ try {
+ final OnboardPackage zipPackage = onboardPackageInfo.getOnboardPackage();
+ final OrchestrationTemplateCandidateData candidateData = new CandidateEntityBuilder(candidateService)
+ .buildCandidateEntityFromZip(vspDetails, zipPackage.getFileContent().array(), zipPackage.getFileContentHandler(),
+ uploadFileResponse.getErrors());
+ candidateData.setFileName(zipPackage.getFilename());
+ candidateData.setFileSuffix(zipPackage.getFileExtension());
+ candidateService.updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(), candidateData);
+ } catch (final Exception exception) {
+ logger.error(getErrorWithParameters(Messages.FILE_LOAD_CONTENT_ERROR.getErrorMessage(), getHandlerType().toString()), exception);
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+ }
+ return uploadFileResponse;
}
- return uploadFileResponse;
- }
- @Override
- protected OnboardingTypesEnum getHandlerType() {
- return OnboardingTypesEnum.ZIP;
- }
+ @Override
+ protected OnboardingTypesEnum getHandlerType() {
+ return OnboardingTypesEnum.ZIP;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
index 4b2decd412..9c881be75e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
@@ -13,9 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_IMPL_KEY;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.openecomp.core.utilities.CommonMethods;
@@ -24,35 +29,24 @@ import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.OrchestrationTemplateFileExtensionErrorBuilder;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_IMPL_KEY;
-
public class OrchestrationUploadFactory {
+
private static final Map<String, ImplementationConfiguration> FILE_HANLDERS;
- private OrchestrationUploadFactory() {
- }
static {
Configuration config = ConfigurationManager.lookup();
- FILE_HANLDERS = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
- ORCHESTRATION_IMPL_KEY, ImplementationConfiguration.class));
+ FILE_HANLDERS = new ConcurrentHashMap<>(
+ config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE, ORCHESTRATION_IMPL_KEY, ImplementationConfiguration.class));
+ }
+ private OrchestrationUploadFactory() {
}
- public static OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(
- final OnboardingTypesEnum onboardingType) {
+ public static OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(final OnboardingTypesEnum onboardingType) {
final ImplementationConfiguration orchestrationTemplateFileHandler = FILE_HANLDERS.get(onboardingType.toString());
-
- if(Objects.isNull(orchestrationTemplateFileHandler)){
- throw new CoreException(new OrchestrationTemplateFileExtensionErrorBuilder
- ().build());
+ if (Objects.isNull(orchestrationTemplateFileHandler)) {
+ throw new CoreException(new OrchestrationTemplateFileExtensionErrorBuilder().build());
}
-
- return CommonMethods.newInstance(orchestrationTemplateFileHandler.getImplementationClass(),
- OrchestrationTemplateFileHandler.class);
+ return CommonMethods.newInstance(orchestrationTemplateFileHandler.getImplementationClass(), OrchestrationTemplateFileHandler.class);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
index ef41262621..bc84e89e74 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
@@ -13,9 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.dao.UniqueValueDaoFactory;
@@ -41,366 +53,290 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.CompositionEntityDataManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.*;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.*;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VspMergeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
-
public class OrchestrationUtil {
- private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationUtil.class);
- public static final String ORCHESTRATION_CONFIG_NAMESPACE = "orchestration";
- public static final String ORCHESTRATION_IMPL_KEY = "orchestration_impl";
-
- private final NicDao nicDao;
- private final ComponentArtifactDao componentArtifactDao;
- private final ProcessDao processDao;
- private final OrchestrationTemplateDao orchestrationTemplateDataDao;
- private final ComponentDao componentDao;
- private final ServiceModelDao serviceModelDao;
- private final ComponentDependencyModelDao componentDependencyModelDao;
- private final CompositionEntityDataManager compositionEntityDataManager;
- private final CompositionDataExtractor compositionDataExtractor;
-
- public OrchestrationUtil() {
- this(NicDaoFactory.getInstance().createInterface(),
- MonitoringUploadDaoFactory.getInstance().createInterface(),
- ProcessDaoFactory.getInstance().createInterface(),
- OrchestrationTemplateDaoFactory.getInstance().createInterface(),
- ComponentDaoFactory.getInstance().createInterface(),
- ServiceModelDaoFactory.getInstance().createInterface(),
- ComponentDependencyModelDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
+ public static final String ORCHESTRATION_CONFIG_NAMESPACE = "orchestration";
+ public static final String ORCHESTRATION_IMPL_KEY = "orchestration_impl";
+ private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationUtil.class);
+ private final NicDao nicDao;
+ private final ComponentArtifactDao componentArtifactDao;
+ private final ProcessDao processDao;
+ private final OrchestrationTemplateDao orchestrationTemplateDataDao;
+ private final ComponentDao componentDao;
+ private final ServiceModelDao serviceModelDao;
+ private final ComponentDependencyModelDao componentDependencyModelDao;
+ private final CompositionEntityDataManager compositionEntityDataManager;
+ private final CompositionDataExtractor compositionDataExtractor;
+
+ public OrchestrationUtil() {
+ this(NicDaoFactory.getInstance().createInterface(), MonitoringUploadDaoFactory.getInstance().createInterface(),
+ ProcessDaoFactory.getInstance().createInterface(), OrchestrationTemplateDaoFactory.getInstance().createInterface(),
+ ComponentDaoFactory.getInstance().createInterface(), ServiceModelDaoFactory.getInstance().createInterface(),
+ ComponentDependencyModelDaoFactory.getInstance().createInterface(), CompositionEntityDataManagerFactory.getInstance().createInterface(),
CompositionDataExtractorFactory.getInstance().createInterface());
- }
-
- private OrchestrationUtil(
- NicDao nicDao,
- ComponentArtifactDao componentArtifactDao,
- ProcessDao processDao,
- OrchestrationTemplateDao orchestrationTemplateDataDao,
- ComponentDao componentDao,
- ServiceModelDao serviceModelDao,
- ComponentDependencyModelDao componentDependencyModelDao,
- CompositionEntityDataManager compositionEntityDataManager,
- CompositionDataExtractor compositionDataExtractor) {
- this.nicDao = nicDao;
- this.componentArtifactDao = componentArtifactDao;
- this.processDao = processDao;
- this.orchestrationTemplateDataDao = orchestrationTemplateDataDao;
- this.componentDao = componentDao;
- this.serviceModelDao = serviceModelDao;
- this.componentDependencyModelDao = componentDependencyModelDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.compositionDataExtractor = compositionDataExtractor;
- }
-
- public static Optional<FileContentHandler> getFileContentMap(OnboardingTypesEnum type,
- UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData) {
- FileContentHandler contentMap = null;
- try {
- contentMap = CommonUtil.validateAndUploadFileContent(type, uploadedFileData);
- } catch (IOException exception) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
- LOGGER.error("{}\n{}", Messages.INVALID_ZIP_FILE.getErrorMessage(),
- exception.getMessage(), exception);
- } catch (CoreException coreException) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
- LOGGER.error(coreException.getMessage(), coreException);
}
- return Optional.ofNullable(contentMap);
- }
-
- public void backupComponentsQuestionnaireBeforeDelete(String vspId, Version version,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>>
- componentMibList,
- Map<String, Collection<ProcessEntity>>
- componentProcesses,
- Map<String, ProcessEntity> processArtifact) {
- Collection<ComponentEntity> componentsCompositionAndQuestionnaire =
- componentDao.listCompositionAndQuestionnaire(vspId, version);
- componentsCompositionAndQuestionnaire.forEach(componentEntity -> {
- String componentName = componentEntity.getComponentCompositionData().getName();
- componentsQustanniare.put(componentName, componentEntity.getQuestionnaireData());
- backupMibData(vspId, version, componentEntity, componentName, componentMibList);
- backupProcess(vspId, version, componentEntity.getId(), componentName, componentProcesses,
- processArtifact);
- backupNicsQuestionnaire(vspId, version, componentEntity, componentName,
- componentNicsQustanniare);
- });
- }
-
- private void backupMibData(String vspId, Version version, ComponentEntity componentEntity,
- String componentName,
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList) {
- Collection<ComponentMonitoringUploadEntity> componentMib =
- componentArtifactDao.listArtifacts(new
- ComponentMonitoringUploadEntity(vspId, version, componentEntity.getId(),
- null));
- if (CollectionUtils.isNotEmpty(componentMib)) {
- componentMibList.put(componentName, componentMib);
+ private OrchestrationUtil(NicDao nicDao, ComponentArtifactDao componentArtifactDao, ProcessDao processDao,
+ OrchestrationTemplateDao orchestrationTemplateDataDao, ComponentDao componentDao, ServiceModelDao serviceModelDao,
+ ComponentDependencyModelDao componentDependencyModelDao, CompositionEntityDataManager compositionEntityDataManager,
+ CompositionDataExtractor compositionDataExtractor) {
+ this.nicDao = nicDao;
+ this.componentArtifactDao = componentArtifactDao;
+ this.processDao = processDao;
+ this.orchestrationTemplateDataDao = orchestrationTemplateDataDao;
+ this.componentDao = componentDao;
+ this.serviceModelDao = serviceModelDao;
+ this.componentDependencyModelDao = componentDependencyModelDao;
+ this.compositionEntityDataManager = compositionEntityDataManager;
+ this.compositionDataExtractor = compositionDataExtractor;
}
- }
- private void backupProcess(String vspId, Version version, String componentId,
- String componentName, Map<String,
- Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- Collection<ProcessEntity> processList =
- processDao.list(new ProcessEntity(vspId, version, componentId, null));
- if (!processList.isEmpty()) {
- processes.put(componentName, processList);
- processList.forEach(process -> {
- ProcessEntity artifact = processDao
- .getArtifact(new ProcessEntity(vspId, version, componentId, process.getId()));
- if (artifact.getArtifact() != null) {
- processArtifact.put(process.getId(), artifact);
+ public static Optional<FileContentHandler> getFileContentMap(OnboardingTypesEnum type, UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData) {
+ FileContentHandler contentMap = null;
+ try {
+ contentMap = CommonUtil.validateAndUploadFileContent(type, uploadedFileData);
+ } catch (IOException exception) {
+ uploadFileResponse
+ .addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
+ LOGGER.error("{}\n{}", Messages.INVALID_ZIP_FILE.getErrorMessage(), exception.getMessage(), exception);
+ } catch (CoreException coreException) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
+ LOGGER.error(coreException.getMessage(), coreException);
}
- });
+ return Optional.ofNullable(contentMap);
}
- }
- private void backupNicsQuestionnaire(String vspId, Version version,
- ComponentEntity componentEntity,
- String componentName,
- Map<String, Map<String, String>> componentNicsQustanniare) {
- Collection<NicEntity>
- nics = nicDao.list(new NicEntity(vspId, version, componentEntity.getId(), null));
- if (CollectionUtils.isNotEmpty(nics)) {
- Map<String, String> nicsQuestionnaire = new HashMap<>();
- nics.forEach(nicEntity -> {
- NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, version,
- componentEntity.getId(), nicEntity.getId());
+ public static HeatStructureTree createHeatTree(FileContentHandler fileContentMap, Map<String, List<ErrorMessage>> validationErrors) {
+ HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap);
+ heatTreeManager.createTree();
+ heatTreeManager.addErrors(validationErrors);
+ return heatTreeManager.getTree();
+ }
- nicsQuestionnaire.put(nicEntity.getNicCompositionData().getName(),
- nicQuestionnaire.getQuestionnaireData());
- });
- componentNicsQustanniare.put(componentName, nicsQuestionnaire);
+ public void backupComponentsQuestionnaireBeforeDelete(String vspId, Version version, Map<String, String> componentsQustanniare,
+ Map<String, Map<String, String>> componentNicsQustanniare,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
+ Map<String, Collection<ProcessEntity>> componentProcesses,
+ Map<String, ProcessEntity> processArtifact) {
+ Collection<ComponentEntity> componentsCompositionAndQuestionnaire = componentDao.listCompositionAndQuestionnaire(vspId, version);
+ componentsCompositionAndQuestionnaire.forEach(componentEntity -> {
+ String componentName = componentEntity.getComponentCompositionData().getName();
+ componentsQustanniare.put(componentName, componentEntity.getQuestionnaireData());
+ backupMibData(vspId, version, componentEntity, componentName, componentMibList);
+ backupProcess(vspId, version, componentEntity.getId(), componentName, componentProcesses, processArtifact);
+ backupNicsQuestionnaire(vspId, version, componentEntity, componentName, componentNicsQustanniare);
+ });
}
- }
- public void retainComponentQuestionnaireData(String vspId, Version version,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
- Map<String, Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- //VSP processes
- restoreProcess(vspId, version, null, null, processes, processArtifact);
- Collection<ComponentEntity> components =
- componentDao.list(new ComponentEntity(vspId, version, null));
- components.forEach(componentEntity -> {
- String componentName = componentEntity.getComponentCompositionData().getName();
- if (componentsQustanniare.containsKey(componentName)) {
- componentDao.updateQuestionnaireData(vspId, version,
- componentEntity.getId(),
- componentsQustanniare.get(componentEntity.getComponentCompositionData()
- .getName()));
- if (componentNicsQustanniare.containsKey(componentName)) {
- restoreComponentNicQuestionnaire(vspId, version, componentName, componentEntity,
- componentNicsQustanniare);
+ private void backupMibData(String vspId, Version version, ComponentEntity componentEntity, String componentName,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList) {
+ Collection<ComponentMonitoringUploadEntity> componentMib = componentArtifactDao
+ .listArtifacts(new ComponentMonitoringUploadEntity(vspId, version, componentEntity.getId(), null));
+ if (CollectionUtils.isNotEmpty(componentMib)) {
+ componentMibList.put(componentName, componentMib);
}
- //MIB //todo add for VES_EVENTS
- if (componentMibList.containsKey(componentName)) {
- restoreComponentMibData(componentName, componentEntity, componentMibList);
- }
- //VFC processes
- restoreProcess(vspId, version, componentEntity.getId(), componentName, processes,
- processArtifact);
- }
- });
- }
-
- private void restoreComponentNicQuestionnaire(String vspId, Version version,
- String componentName,
- ComponentEntity componentEntity,
- Map<String, Map<String, String>> componentNicsQustanniare) {
- Map<String, String> nicsQustanniare = componentNicsQustanniare.get(componentName);
- Collection<NicEntity> nics =
- nicDao.list(new NicEntity(vspId, version, componentEntity.getId(), null));
- nics.forEach(nicEntity -> {
- if (nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())) {
- nicDao.updateQuestionnaireData(vspId, version,
- componentEntity.getId(), nicEntity.getId(),
- nicsQustanniare.get(nicEntity.getNicCompositionData().getName()));
- }
- });
- }
-
- private void restoreComponentMibData(String componentName, ComponentEntity componentEntity,
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList) {
- Collection<ComponentMonitoringUploadEntity> mibList = componentMibList.get(componentName);
- mibList.forEach(mib -> {
- mib.setComponentId(componentEntity.getId());
- componentArtifactDao.create(mib);
- });
- }
+ }
- private void restoreProcess(String vspId, Version version, String componentId,
- String componentName,
- Map<String, Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- if (processes.containsKey(componentName)) {
- Collection<ProcessEntity> processList = processes.get(componentName);
- processList.forEach(process -> {
- process.setComponentId(componentId);
- UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance()
- .createInterface());
- uniqueValueUtil.createUniqueValue(PROCESS_NAME, vspId, version.getId(), componentId,
- process.getName());
- processDao.create(process);
- if (processArtifact.containsKey(process.getId())) {
- ProcessEntity artifact = processArtifact.get(process.getId());
- processDao.uploadArtifact(artifact);
+ private void backupProcess(String vspId, Version version, String componentId, String componentName,
+ Map<String, Collection<ProcessEntity>> processes, Map<String, ProcessEntity> processArtifact) {
+ Collection<ProcessEntity> processList = processDao.list(new ProcessEntity(vspId, version, componentId, null));
+ if (!processList.isEmpty()) {
+ processes.put(componentName, processList);
+ processList.forEach(process -> {
+ ProcessEntity artifact = processDao.getArtifact(new ProcessEntity(vspId, version, componentId, process.getId()));
+ if (artifact.getArtifact() != null) {
+ processArtifact.put(process.getId(), artifact);
+ }
+ });
}
- });
}
- }
- public void deleteUploadDataAndContent(String vspId, Version version) {
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface()
- .delete(new VspDetails(vspId, version));
- }
+ private void backupNicsQuestionnaire(String vspId, Version version, ComponentEntity componentEntity, String componentName,
+ Map<String, Map<String, String>> componentNicsQustanniare) {
+ Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentEntity.getId(), null));
+ if (CollectionUtils.isNotEmpty(nics)) {
+ Map<String, String> nicsQuestionnaire = new HashMap<>();
+ nics.forEach(nicEntity -> {
+ NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, version, componentEntity.getId(), nicEntity.getId());
+ nicsQuestionnaire.put(nicEntity.getNicCompositionData().getName(), nicQuestionnaire.getQuestionnaireData());
+ });
+ componentNicsQustanniare.put(componentName, nicsQuestionnaire);
+ }
+ }
- public void saveUploadData(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData,
- InputStream uploadedFileData,
- FileContentHandler fileContentMap, HeatStructureTree tree) {
- Map<String, Object> manifestAsMap =
- fileContentMap.containsFile(SdcCommon.MANIFEST_NAME)
- ? (Map<String, Object>) JsonUtil.json2Object(fileContentMap.getFileContentAsStream(
- SdcCommon.MANIFEST_NAME), Map.class)
- : new HashMap<>();
+ public void retainComponentQuestionnaireData(String vspId, Version version, Map<String, String> componentsQustanniare,
+ Map<String, Map<String, String>> componentNicsQustanniare,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
+ Map<String, Collection<ProcessEntity>> processes, Map<String, ProcessEntity> processArtifact) {
+ //VSP processes
+ restoreProcess(vspId, version, null, null, processes, processArtifact);
+ Collection<ComponentEntity> components = componentDao.list(new ComponentEntity(vspId, version, null));
+ components.forEach(componentEntity -> {
+ String componentName = componentEntity.getComponentCompositionData().getName();
+ if (componentsQustanniare.containsKey(componentName)) {
+ componentDao.updateQuestionnaireData(vspId, version, componentEntity.getId(),
+ componentsQustanniare.get(componentEntity.getComponentCompositionData().getName()));
+ if (componentNicsQustanniare.containsKey(componentName)) {
+ restoreComponentNicQuestionnaire(vspId, version, componentName, componentEntity, componentNicsQustanniare);
+ }
+ //MIB //todo add for VES_EVENTS
+ if (componentMibList.containsKey(componentName)) {
+ restoreComponentMibData(componentName, componentEntity, componentMibList);
+ }
+ //VFC processes
+ restoreProcess(vspId, version, componentEntity.getId(), componentName, processes, processArtifact);
+ }
+ });
+ }
- OrchestrationTemplateEntity uploadData = new OrchestrationTemplateEntity();
- uploadData.setFileSuffix(candidateData.getFileSuffix());
- uploadData.setFileName(candidateData.getFileName());
- uploadData.setContentData(ByteBuffer.wrap(FileUtils.toByteArray(uploadedFileData)));
- uploadData.setValidationDataStructure(new ValidationStructureList(tree));
- uploadData.setPackageName(Objects.isNull(manifestAsMap.get("name")) ? null :
- (String) manifestAsMap.get("name"));
- uploadData.setPackageVersion(Objects.isNull(manifestAsMap.get("version")) ? null :
- (String) manifestAsMap.get("version"));
- uploadData.setFilesDataStructure(candidateData.getFilesDataStructure());
- orchestrationTemplateDataDao.update(vspDetails.getId(), vspDetails.getVersion(), uploadData);
+ private void restoreComponentNicQuestionnaire(String vspId, Version version, String componentName, ComponentEntity componentEntity,
+ Map<String, Map<String, String>> componentNicsQustanniare) {
+ Map<String, String> nicsQustanniare = componentNicsQustanniare.get(componentName);
+ Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentEntity.getId(), null));
+ nics.forEach(nicEntity -> {
+ if (nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())) {
+ nicDao.updateQuestionnaireData(vspId, version, componentEntity.getId(), nicEntity.getId(),
+ nicsQustanniare.get(nicEntity.getNicCompositionData().getName()));
+ }
+ });
+ }
- VspMergeDaoFactory.getInstance().createInterface()
- .updateHint(vspDetails.getId(), vspDetails.getVersion());
- }
+ private void restoreComponentMibData(String componentName, ComponentEntity componentEntity,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList) {
+ Collection<ComponentMonitoringUploadEntity> mibList = componentMibList.get(componentName);
+ mibList.forEach(mib -> {
+ mib.setComponentId(componentEntity.getId());
+ componentArtifactDao.create(mib);
+ });
+ }
- public void saveServiceModel(String vspId, Version version,
- ToscaServiceModel serviceModelToExtract,
- ToscaServiceModel serviceModelToStore) {
- if (serviceModelToExtract != null) {
- serviceModelDao.storeServiceModel(vspId, version, serviceModelToStore);
- //Extracting the compostion data from the output service model of the first phase of
- // translation
- compositionEntityDataManager.saveCompositionData(vspId, version,
- compositionDataExtractor.extractServiceCompositionData(serviceModelToExtract));
+ private void restoreProcess(String vspId, Version version, String componentId, String componentName,
+ Map<String, Collection<ProcessEntity>> processes, Map<String, ProcessEntity> processArtifact) {
+ if (processes.containsKey(componentName)) {
+ Collection<ProcessEntity> processList = processes.get(componentName);
+ processList.forEach(process -> {
+ process.setComponentId(componentId);
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ uniqueValueUtil.createUniqueValue(PROCESS_NAME, vspId, version.getId(), componentId, process.getName());
+ processDao.create(process);
+ if (processArtifact.containsKey(process.getId())) {
+ ProcessEntity artifact = processArtifact.get(process.getId());
+ processDao.uploadArtifact(artifact);
+ }
+ });
+ }
}
- }
- public static HeatStructureTree createHeatTree(FileContentHandler fileContentMap,
- Map<String, List<ErrorMessage>> validationErrors) {
- HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap);
- heatTreeManager.createTree();
- heatTreeManager.addErrors(validationErrors);
- return heatTreeManager.getTree();
- }
+ public void deleteUploadDataAndContent(String vspId, Version version) {
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface().delete(new VspDetails(vspId, version));
+ }
- public void updateVspComponentDependencies(String vspId, Version version,
- Map<String, String>
- vspComponentIdNameInfoBeforeProcess,
- Collection<ComponentDependencyModelEntity>
- componentDependenciesBeforeDelete) {
- Map<String, String> updatedVspComponentNameIdInfo = getVspComponentNameIdInfo(vspId, version);
- if (MapUtils.isNotEmpty(updatedVspComponentNameIdInfo)) {
- Set<String> updatedVspComponentNames = updatedVspComponentNameIdInfo.keySet();
- if (CollectionUtils.isNotEmpty(componentDependenciesBeforeDelete)) {
- restoreComponentDependencies(vspId, version, vspComponentIdNameInfoBeforeProcess,
- componentDependenciesBeforeDelete, updatedVspComponentNames,
- updatedVspComponentNameIdInfo);
- }
+ public void saveUploadData(VspDetails vspDetails, OrchestrationTemplateCandidateData candidateData, InputStream uploadedFileData,
+ FileContentHandler fileContentMap, HeatStructureTree tree) {
+ Map<String, Object> manifestAsMap = fileContentMap.containsFile(SdcCommon.MANIFEST_NAME) ? (Map<String, Object>) JsonUtil
+ .json2Object(fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME), Map.class) : new HashMap<>();
+ OrchestrationTemplateEntity uploadData = new OrchestrationTemplateEntity();
+ uploadData.setFileSuffix(candidateData.getFileSuffix());
+ uploadData.setFileName(candidateData.getFileName());
+ uploadData.setContentData(ByteBuffer.wrap(FileUtils.toByteArray(uploadedFileData)));
+ uploadData.setValidationDataStructure(new ValidationStructureList(tree));
+ uploadData.setPackageName(Objects.isNull(manifestAsMap.get("name")) ? null : (String) manifestAsMap.get("name"));
+ uploadData.setPackageVersion(Objects.isNull(manifestAsMap.get("version")) ? null : (String) manifestAsMap.get("version"));
+ uploadData.setFilesDataStructure(candidateData.getFilesDataStructure());
+ orchestrationTemplateDataDao.update(vspDetails.getId(), vspDetails.getVersion(), uploadData);
+ VspMergeDaoFactory.getInstance().createInterface().updateHint(vspDetails.getId(), vspDetails.getVersion());
}
- }
- private void restoreComponentDependencies(String vspId, Version version,
- Map<String, String> vspComponentIdNameInfoBeforeProcess,
- Collection<ComponentDependencyModelEntity>
- componentDependenciesBeforeDelete,
- Set<String> updatedVspComponentNames,
- Map<String, String> updatedVspComponentNameIdInfo) {
- for (ComponentDependencyModelEntity componentDependency : componentDependenciesBeforeDelete) {
- String sourceComponentName = vspComponentIdNameInfoBeforeProcess.get(componentDependency
- .getSourceComponentId());
- String targetComponentName = vspComponentIdNameInfoBeforeProcess.get(componentDependency
- .getTargetComponentId());
- if (updatedVspComponentNames.contains(sourceComponentName)
- && (updatedVspComponentNames.contains(targetComponentName))) {
- ComponentDependencyModelEntity restoredDependency =
- new ComponentDependencyModelEntity(vspId, version, null);
- String newSourceComponentId = updatedVspComponentNameIdInfo.get(sourceComponentName);
- restoredDependency.setSourceComponentId(newSourceComponentId);
- String newTargetComponentId = updatedVspComponentNameIdInfo.get(targetComponentName);
- restoredDependency.setTargetComponentId(newTargetComponentId);
- restoredDependency.setRelation(componentDependency.getRelation());
- componentDependencyModelDao.create(restoredDependency);
- }
+ public void saveServiceModel(String vspId, Version version, ToscaServiceModel serviceModelToExtract, ToscaServiceModel serviceModelToStore) {
+ if (serviceModelToExtract != null) {
+ serviceModelDao.storeServiceModel(vspId, version, serviceModelToStore);
+ //Extracting the compostion data from the output service model of the first phase of
+
+ // translation
+ compositionEntityDataManager
+ .saveCompositionData(vspId, version, compositionDataExtractor.extractServiceCompositionData(serviceModelToExtract));
+ }
}
- }
- public Map<String, String> getVspComponentIdNameInfo(String vspId, Version version) {
- Collection<ComponentEntity> updatedVspComponents =
- componentDao.list(new ComponentEntity(vspId, version, null));
- Map<String, String> vspComponentIdNameMap = new HashMap<>();
- if (CollectionUtils.isNotEmpty(updatedVspComponents)) {
- vspComponentIdNameMap = updatedVspComponents.stream()
- .filter(componentEntity -> componentEntity.getComponentCompositionData() != null)
- .collect(Collectors.toMap(ComponentEntity::getId,
- componentEntity -> componentEntity.getComponentCompositionData().getName()));
+ public void updateVspComponentDependencies(String vspId, Version version, Map<String, String> vspComponentIdNameInfoBeforeProcess,
+ Collection<ComponentDependencyModelEntity> componentDependenciesBeforeDelete) {
+ Map<String, String> updatedVspComponentNameIdInfo = getVspComponentNameIdInfo(vspId, version);
+ if (MapUtils.isNotEmpty(updatedVspComponentNameIdInfo)) {
+ Set<String> updatedVspComponentNames = updatedVspComponentNameIdInfo.keySet();
+ if (CollectionUtils.isNotEmpty(componentDependenciesBeforeDelete)) {
+ restoreComponentDependencies(vspId, version, vspComponentIdNameInfoBeforeProcess, componentDependenciesBeforeDelete,
+ updatedVspComponentNames, updatedVspComponentNameIdInfo);
+ }
+ }
+ }
+ private void restoreComponentDependencies(String vspId, Version version, Map<String, String> vspComponentIdNameInfoBeforeProcess,
+ Collection<ComponentDependencyModelEntity> componentDependenciesBeforeDelete,
+ Set<String> updatedVspComponentNames, Map<String, String> updatedVspComponentNameIdInfo) {
+ for (ComponentDependencyModelEntity componentDependency : componentDependenciesBeforeDelete) {
+ String sourceComponentName = vspComponentIdNameInfoBeforeProcess.get(componentDependency.getSourceComponentId());
+ String targetComponentName = vspComponentIdNameInfoBeforeProcess.get(componentDependency.getTargetComponentId());
+ if (updatedVspComponentNames.contains(sourceComponentName) && (updatedVspComponentNames.contains(targetComponentName))) {
+ ComponentDependencyModelEntity restoredDependency = new ComponentDependencyModelEntity(vspId, version, null);
+ String newSourceComponentId = updatedVspComponentNameIdInfo.get(sourceComponentName);
+ restoredDependency.setSourceComponentId(newSourceComponentId);
+ String newTargetComponentId = updatedVspComponentNameIdInfo.get(targetComponentName);
+ restoredDependency.setTargetComponentId(newTargetComponentId);
+ restoredDependency.setRelation(componentDependency.getRelation());
+ componentDependencyModelDao.create(restoredDependency);
+ }
+ }
}
- return vspComponentIdNameMap;
- }
- public Collection<ComponentDependencyModelEntity> getComponentDependenciesBeforeDelete(String
- vspId, Version version) {
- return componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId,
- version, null));
- }
+ public Map<String, String> getVspComponentIdNameInfo(String vspId, Version version) {
+ Collection<ComponentEntity> updatedVspComponents = componentDao.list(new ComponentEntity(vspId, version, null));
+ Map<String, String> vspComponentIdNameMap = new HashMap<>();
+ if (CollectionUtils.isNotEmpty(updatedVspComponents)) {
+ vspComponentIdNameMap = updatedVspComponents.stream().filter(componentEntity -> componentEntity.getComponentCompositionData() != null)
+ .collect(Collectors.toMap(ComponentEntity::getId, componentEntity -> componentEntity.getComponentCompositionData().getName()));
+ }
+ return vspComponentIdNameMap;
+ }
- private Map<String, String> getVspComponentNameIdInfo(String vspId,
- Version version) {
- Collection<ComponentEntity> updatedVspComponents =
- componentDao.list(new ComponentEntity(vspId, version, null));
- Map<String, String> vspComponentNameIdMap = new HashMap<>();
- if (CollectionUtils.isNotEmpty(updatedVspComponents)) {
- vspComponentNameIdMap = updatedVspComponents.stream()
- .filter(componentEntity -> componentEntity.getComponentCompositionData() != null)
- .collect(Collectors
- .toMap(componentEntity -> componentEntity.getComponentCompositionData().getName(),
- ComponentEntity::getId));
+ public Collection<ComponentDependencyModelEntity> getComponentDependenciesBeforeDelete(String vspId, Version version) {
+ return componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null));
}
- return vspComponentNameIdMap;
- }
+ private Map<String, String> getVspComponentNameIdInfo(String vspId, Version version) {
+ Collection<ComponentEntity> updatedVspComponents = componentDao.list(new ComponentEntity(vspId, version, null));
+ Map<String, String> vspComponentNameIdMap = new HashMap<>();
+ if (CollectionUtils.isNotEmpty(updatedVspComponents)) {
+ vspComponentNameIdMap = updatedVspComponents.stream().filter(componentEntity -> componentEntity.getComponentCompositionData() != null)
+ .collect(Collectors.toMap(componentEntity -> componentEntity.getComponentCompositionData().getName(), ComponentEntity::getId));
+ }
+ return vspComponentNameIdMap;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidator.java
index 0efe65b3b6..81a17f333b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidator.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
import java.util.Optional;
@@ -55,7 +54,6 @@ public class CsarSecurityValidator {
if (certificateFilePath.isPresent()) {
certificateBytes = fileContentHandler.getFileContent(certificateFilePath.get());
}
-
return securityManager.verifySignedData(signatureBytes, certificateBytes, archiveBytes);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ManifestBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ManifestBuilder.java
index eff1fb31cd..ee708b4176 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ManifestBuilder.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ManifestBuilder.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
import static org.openecomp.sdc.tosca.csar.ManifestTokenType.ALGORITHM;
@@ -36,19 +35,18 @@ import java.util.TreeMap;
*/
public class ManifestBuilder {
+ private static final String PROPERTY_FORMAT = "%s: %s%n";
+ private static final String SECTION_FORMAT = "%s:%n";
private final Map<String, Map<String, String>> sourceWithPropertiesMap = new TreeMap<>();
private final Map<String, List<String>> nonManoArtifactMap = new TreeMap<>();
private final Map<String, String> metadataMap = new TreeMap<>();
- private static final String PROPERTY_FORMAT = "%s: %s%n";
- private static final String SECTION_FORMAT = "%s:%n";
/**
* Adds a metadata property.
*
- * @param metadataProperty the property name
- * @param value the property value
- * @return
- * a reference to this object.
+ * @param metadataProperty the property name
+ * @param value the property value
+ * @return a reference to this object.
*/
public ManifestBuilder withMetaData(final String metadataProperty, final String value) {
metadataMap.put(metadataProperty, value);
@@ -58,9 +56,8 @@ public class ManifestBuilder {
/**
* Adds a manifest source path.
*
- * @param sourcePath The source path
- * @return
- * a reference to this object.
+ * @param sourcePath The source path
+ * @return a reference to this object.
*/
public ManifestBuilder withSource(final String sourcePath) {
sourceWithPropertiesMap.put(sourcePath, null);
@@ -71,10 +68,9 @@ public class ManifestBuilder {
* Adds a manifest source path with the source sign.
*
* @param sourcePath The source path
- * @param hashAlgorithm The hash algorithm
+ * @param hashAlgorithm The hash algorithm
* @param hash The hash representing the sign
- * @return
- * a reference to this object.
+ * @return a reference to this object.
*/
public ManifestBuilder withSignedSource(final String sourcePath, final String hashAlgorithm, final String hash) {
TreeMap<String, String> sourcePropertiesMap = new TreeMap<>();
@@ -87,10 +83,9 @@ public class ManifestBuilder {
/**
* Adds a non mano artifact.
*
- * @param artifactType the artifact type
- * @param sourcePath the artifact source path
- * @return
- * a reference to this object.
+ * @param artifactType the artifact type
+ * @param sourcePath the artifact source path
+ * @return a reference to this object.
*/
public ManifestBuilder withNonManoArtifact(final String artifactType, final String sourcePath) {
nonManoArtifactMap.putIfAbsent(artifactType, new ArrayList<>());
@@ -98,27 +93,22 @@ public class ManifestBuilder {
return this;
}
-
/**
* Builds the String representing the manifest file.
- * @return
- * The manifest file as String
+ *
+ * @return The manifest file as String
*/
public String build() {
final StringBuilder stringBuilder = new StringBuilder();
-
if (!metadataMap.isEmpty()) {
stringBuilder.append(buildMetadata());
}
-
if (!sourceWithPropertiesMap.isEmpty()) {
stringBuilder.append(buildSource());
}
-
if (!nonManoArtifactMap.isEmpty()) {
stringBuilder.append(buildNonManoArtifact());
}
-
return stringBuilder.toString();
}
@@ -143,7 +133,6 @@ public class ManifestBuilder {
if (algorithm != null) {
stringBuilder.append(String.format(PROPERTY_FORMAT, ALGORITHM.getToken(), algorithm));
}
-
final String hash = propertiesMap.get(HASH.getToken());
if (hash != null) {
stringBuilder.append(String.format(PROPERTY_FORMAT, HASH.getToken(), hash));
@@ -167,5 +156,4 @@ public class ManifestBuilder {
}
return stringBuilder.toString();
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidator.java
index 0d5aef58ac..486970451f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidator.java
@@ -17,7 +17,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
@@ -51,7 +50,6 @@ import org.openecomp.sdc.tosca.csar.ToscaMetadata;
class ONAPCsarValidator implements Validator {
private static Logger logger = LoggerFactory.getLogger(ONAPCsarValidator.class);
-
private List<ErrorMessage> uploadFileErrors = new ArrayList<>();
@Override
@@ -61,30 +59,26 @@ class ONAPCsarValidator implements Validator {
validateMetadata(contentHandler);
validateNoExtraFiles(contentHandler);
validateFolders(contentHandler.getFolderList());
-
- if(uploadFileErrors == null || uploadFileErrors.isEmpty()){
+ if (uploadFileErrors == null || uploadFileErrors.isEmpty()) {
return errors;
}
errors.put(SdcCommon.UPLOAD_FILE, uploadFileErrors);
return errors;
}
- private void validateMetadata(FileContentHandler contentMap){
+ private void validateMetadata(FileContentHandler contentMap) {
if (!validateTOSCAYamlFileInRootExist(contentMap, MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME)) {
try (InputStream metaFileContent = contentMap.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME)) {
-
ToscaMetadata onboardingToscaMetadata = OnboardingToscaMetadata.parseToscaMetadataFile(metaFileContent);
String entryDefinitionsPath = onboardingToscaMetadata.getMetaEntries().get(ENTRY_DEFINITIONS.getName());
if (entryDefinitionsPath != null) {
validateFileExist(contentMap, entryDefinitionsPath);
} else {
- uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR,
- Messages.METADATA_NO_ENTRY_DEFINITIONS.getErrorMessage()));
+ uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR, Messages.METADATA_NO_ENTRY_DEFINITIONS.getErrorMessage()));
}
} catch (IOException exception) {
logger.error(exception.getMessage(), exception);
- uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR,
- Messages.FAILED_TO_VALIDATE_METADATA.getErrorMessage()));
+ uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR, Messages.FAILED_TO_VALIDATE_METADATA.getErrorMessage()));
}
} else {
validateFileExist(contentMap, MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
@@ -95,40 +89,32 @@ class ONAPCsarValidator implements Validator {
if (!validateFileExist(contentMap, MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
return;
}
-
try (final InputStream fileContent = contentMap.getFileContentAsStream(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
final Manifest onboardingManifest = new ONAPManifestOnboarding();
onboardingManifest.parse(fileContent);
if (!onboardingManifest.isValid()) {
- onboardingManifest.getErrors()
- .forEach(error -> uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR, error)));
+ onboardingManifest.getErrors().forEach(error -> uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR, error)));
}
} catch (final IOException ex) {
- final String errorMessage =
- Messages.MANIFEST_UNEXPECTED_ERROR.formatMessage(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME, ex.getMessage());
+ final String errorMessage = Messages.MANIFEST_UNEXPECTED_ERROR.formatMessage(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME, ex.getMessage());
uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR, errorMessage));
logger.error(errorMessage, ex);
}
}
private void validateNoExtraFiles(FileContentHandler contentMap) {
- List<String> unwantedFiles = contentMap.getFileList().stream()
- .filter(this::filterFiles).collect(Collectors.toList());
+ List<String> unwantedFiles = contentMap.getFileList().stream().filter(this::filterFiles).collect(Collectors.toList());
if (!unwantedFiles.isEmpty()) {
- unwantedFiles.stream().filter(this::filterFiles).forEach(unwantedFile ->
- uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.CSAR_FILES_NOT_ALLOWED.getErrorMessage(), unwantedFile))));
+ unwantedFiles.stream().filter(this::filterFiles).forEach(unwantedFile -> uploadFileErrors
+ .add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(Messages.CSAR_FILES_NOT_ALLOWED.getErrorMessage(), unwantedFile))));
}
}
private void validateFolders(Set<String> folderList) {
- List<String> filterResult =
- folderList.stream().filter(this::filterFolders).collect(Collectors.toList());
+ List<String> filterResult = folderList.stream().filter(this::filterFolders).collect(Collectors.toList());
if (!filterResult.isEmpty()) {
- folderList.stream().filter(this::filterFolders).forEach(unwantedFolder ->
- uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.CSAR_DIRECTORIES_NOT_ALLOWED.getErrorMessage(),
- unwantedFolder))));
+ folderList.stream().filter(this::filterFolders).forEach(unwantedFolder -> uploadFileErrors.add(
+ new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(Messages.CSAR_DIRECTORIES_NOT_ALLOWED.getErrorMessage(), unwantedFolder))));
}
}
@@ -146,11 +132,10 @@ class ONAPCsarValidator implements Validator {
}
private boolean validateFileExist(FileContentHandler contentMap, String fileName) {
-
boolean containsFile = contentMap.containsFile(fileName);
if (!containsFile) {
- uploadFileErrors.add(new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.CSAR_FILE_NOT_FOUND.getErrorMessage(), fileName)));
+ uploadFileErrors
+ .add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(Messages.CSAR_FILE_NOT_FOUND.getErrorMessage(), fileName)));
}
return containsFile;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java
index 90270c2f7e..77c7347e49 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java
@@ -30,19 +30,14 @@ import org.onap.validation.yaml.error.YamlDocumentValidationError;
public class PMDictionaryValidator {
public void validate(Stream<byte[]> pmDictionaryFiles, Consumer<String> errorReporter) {
- pmDictionaryFiles
- .map(this::validate)
- .flatMap(Collection::stream)
- .forEach(errorReporter);
+ pmDictionaryFiles.map(this::validate).flatMap(Collection::stream).forEach(errorReporter);
}
private List<String> validate(byte[] fileContent) {
List<String> errors = new ArrayList<>();
try {
List<YamlDocumentValidationError> validationErrors = new YamlContentValidator().validate(fileContent);
- validationErrors.stream()
- .map(this::formatErrorMessage)
- .forEach(errors::add);
+ validationErrors.stream().map(this::formatErrorMessage).forEach(errors::add);
} catch (Exception e) {
errors.add(e.getMessage());
}
@@ -50,9 +45,6 @@ public class PMDictionaryValidator {
}
private String formatErrorMessage(YamlDocumentValidationError error) {
- return String.format("Document number: %d, Path: %s, Message: %s",
- error.getYamlDocumentNumber(),
- error.getPath(),
- error.getMessage());
+ return String.format("Document number: %d, Path: %s, Message: %s", error.getYamlDocumentNumber(), error.getPath(), error.getMessage());
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
index 22ab4f45a6..d99848ddb8 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
@@ -19,10 +19,8 @@
* * Modifications copyright (c) 2020 Nokia
* ================================================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
-
import static org.openecomp.sdc.be.config.NonManoArtifactType.ONAP_CNF_HELM;
import static org.openecomp.sdc.be.config.NonManoArtifactType.ONAP_PM_DICTIONARY;
import static org.openecomp.sdc.be.config.NonManoArtifactType.ONAP_SW_INFORMATION;
@@ -44,6 +42,7 @@ import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.TOSCA_META_FILE_VERSIO
import static org.openecomp.sdc.tosca.csar.ToscaMetadataFileInfo.TOSCA_META_FILE_VERSION_1_0;
import static org.openecomp.sdc.tosca.csar.ToscaMetadataFileInfo.TOSCA_META_PATH_FILE_NAME;
+import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -57,8 +56,6 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-
-import com.google.common.collect.ImmutableSet;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
import org.openecomp.core.impl.ToscaDefinitionImportHandler;
@@ -89,22 +86,21 @@ import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManagerException
import org.yaml.snakeyaml.Yaml;
/**
- * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure
- * as defined in ETSI GS NFV-SOL 004 v2.6.1.
+ * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure as defined in ETSI GS NFV-SOL
+ * 004 v2.6.1.
*/
class SOL004MetaDirectoryValidator implements Validator {
private static final Logger LOGGER = LoggerFactory.getLogger(SOL004MetaDirectoryValidator.class);
-
private static final String MANIFEST_SOURCE = "Source";
private static final String MANIFEST_NON_MANO_SOURCE = "Non-MANO Source";
+ protected final ValidatorUtils validatorUtils = new ValidatorUtils();
private final List<ErrorMessage> errorsByFile = new CopyOnWriteArrayList<>();
private final SecurityManager securityManager;
+ private final InternalFilesFilter internalFilesFilter = new InternalFilesFilter();
private OnboardingPackageContentHandler contentHandler;
private Set<String> folderList;
private ToscaMetadata toscaMetadata;
- private final InternalFilesFilter internalFilesFilter = new InternalFilesFilter();
- protected final ValidatorUtils validatorUtils = new ValidatorUtils();
public SOL004MetaDirectoryValidator() {
securityManager = SecurityManager.getInstance();
@@ -121,7 +117,6 @@ class SOL004MetaDirectoryValidator implements Validator {
this.folderList = contentHandler.getFolderList();
parseToscaMetadata();
verifyMetadataFile();
-
if (packageHasCertificate()) {
verifySignedFiles();
}
@@ -143,9 +138,7 @@ class SOL004MetaDirectoryValidator implements Validator {
*/
private void parseToscaMetadata() {
try {
- toscaMetadata =
- OnboardingToscaMetadata
- .parseToscaMetadataFile(contentHandler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME));
+ toscaMetadata = OnboardingToscaMetadata.parseToscaMetadataFile(contentHandler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME));
} catch (final IOException e) {
reportError(ErrorLevel.ERROR, Messages.METADATA_PARSER_INTERNAL.getErrorMessage());
LOGGER.error(Messages.METADATA_PARSER_INTERNAL.getErrorMessage(), e.getMessage(), e);
@@ -175,12 +168,11 @@ class SOL004MetaDirectoryValidator implements Validator {
final byte[] fileSignatureBytes = contentHandler.getFileContent(fileSignaturePath);
try {
if (!securityManager.verifySignedData(fileSignatureBytes, packageCert, fileBytes)) {
- reportError(ErrorLevel.ERROR,
- Messages.ARTIFACT_INVALID_SIGNATURE.formatMessage(fileSignaturePath, filePath));
+ reportError(ErrorLevel.ERROR, Messages.ARTIFACT_INVALID_SIGNATURE.formatMessage(fileSignaturePath, filePath));
}
} catch (final SecurityManagerException e) {
final String errorMessage = Messages.ARTIFACT_SIGNATURE_VALIDATION_ERROR
- .formatMessage(fileSignaturePath, filePath, packageCertificatePath, e.getMessage());
+ .formatMessage(fileSignaturePath, filePath, packageCertificatePath, e.getMessage());
reportError(ErrorLevel.ERROR, errorMessage);
LOGGER.error(errorMessage, e);
}
@@ -196,8 +188,7 @@ class SOL004MetaDirectoryValidator implements Validator {
reportError(ErrorLevel.ERROR, Messages.MANIFEST_INVALID_EXT.getErrorMessage());
}
if (!mainDefinitionFileName.equals(manifestFileName)) {
- reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_INVALID_NAME.getErrorMessage(),
- manifestFileName, mainDefinitionFileName));
+ reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_INVALID_NAME.getErrorMessage(), manifestFileName, mainDefinitionFileName));
}
}
@@ -211,15 +202,13 @@ class SOL004MetaDirectoryValidator implements Validator {
private boolean hasETSIMetadata() {
final Map<String, String> entries = toscaMetadata.getMetaEntries();
- return hasEntry(entries, TOSCA_META_FILE_VERSION_ENTRY.getName())
- && hasEntry(entries, CSAR_VERSION_ENTRY.getName())
- && hasEntry(entries, CREATED_BY_ENTRY.getName());
+ return hasEntry(entries, TOSCA_META_FILE_VERSION_ENTRY.getName()) && hasEntry(entries, CSAR_VERSION_ENTRY.getName()) && hasEntry(entries,
+ CREATED_BY_ENTRY.getName());
}
private boolean hasEntry(final Map<String, String> entries, final String mandatoryEntry) {
if (!entries.containsKey(mandatoryEntry)) {
- reportError(ErrorLevel.ERROR,
- String.format(Messages.METADATA_MISSING_ENTRY.getErrorMessage(), mandatoryEntry));
+ reportError(ErrorLevel.ERROR, String.format(Messages.METADATA_MISSING_ENTRY.getErrorMessage(), mandatoryEntry));
return false;
}
return true;
@@ -237,7 +226,6 @@ class SOL004MetaDirectoryValidator implements Validator {
return;
}
final String value = entry.getValue();
-
switch (toscaMetaEntry) {
case TOSCA_META_FILE_VERSION_ENTRY:
case CSAR_VERSION_ENTRY:
@@ -277,18 +265,14 @@ class SOL004MetaDirectoryValidator implements Validator {
validateOtherEntries(value);
} else {
final String key = (String) entry.getKey();
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MANIFEST_INVALID_PNF_METADATA.getErrorMessage(), key));
+ reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_INVALID_PNF_METADATA.getErrorMessage(), key));
}
-
}
}
private void verifyMetadataEntryVersions(final String key, final String version) {
- if (!(isValidTOSCAVersion(key, version) || isValidCSARVersion(key, version)
- || CREATED_BY_ENTRY.getName().equals(key))) {
- errorsByFile.add(new ErrorMessage(ErrorLevel.ERROR,
- String.format(Messages.METADATA_INVALID_VERSION.getErrorMessage(), key, version)));
+ if (!(isValidTOSCAVersion(key, version) || isValidCSARVersion(key, version) || CREATED_BY_ENTRY.getName().equals(key))) {
+ errorsByFile.add(new ErrorMessage(ErrorLevel.ERROR, String.format(Messages.METADATA_INVALID_VERSION.getErrorMessage(), key, version)));
LOGGER.error("{}: key {} - value {} ", Messages.METADATA_INVALID_VERSION.getErrorMessage(), key, version);
}
}
@@ -298,16 +282,13 @@ class SOL004MetaDirectoryValidator implements Validator {
}
private boolean isValidCSARVersion(final String value, final String version) {
- return CSAR_VERSION_ENTRY.getName().equals(value) && (CSAR_VERSION_1_1.equals(version)
- || CSAR_VERSION_1_0.equals(version));
+ return CSAR_VERSION_ENTRY.getName().equals(value) && (CSAR_VERSION_1_1.equals(version) || CSAR_VERSION_1_0.equals(version));
}
protected void validateDefinitionFile(final String filePath) {
final Set<String> existingFiles = contentHandler.getFileList();
-
if (verifyFileExists(existingFiles, filePath)) {
- final ToscaDefinitionImportHandler toscaDefinitionImportHandler =
- new ToscaDefinitionImportHandler(contentHandler.getFiles(), filePath);
+ final ToscaDefinitionImportHandler toscaDefinitionImportHandler = new ToscaDefinitionImportHandler(contentHandler.getFiles(), filePath);
final List<ErrorMessage> validationErrorList = toscaDefinitionImportHandler.getErrors();
if (CollectionUtils.isNotEmpty(validationErrorList)) {
errorsByFile.addAll(validationErrorList);
@@ -345,31 +326,23 @@ class SOL004MetaDirectoryValidator implements Validator {
private void verifyManifestMetadata(final Map<String, String> metadata) {
if (!validMetaLimit(metadata)) {
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT.getErrorMessage(),
- MANIFEST_METADATA_LIMIT));
+ reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT.getErrorMessage(), MANIFEST_METADATA_LIMIT));
}
handleMetadataEntries(metadata);
}
protected boolean isPnfMetadata(final Map<String, String> metadata) {
final String firstMetadataDefinition = metadata.keySet().iterator().next();
- final String expectedMetadataType =
- firstMetadataDefinition.contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
- if (metadata.keySet().stream()
- .anyMatch((final String metadataEntry) -> !metadataEntry.contains(expectedMetadataType))) {
+ final String expectedMetadataType = firstMetadataDefinition.contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
+ if (metadata.keySet().stream().anyMatch((final String metadataEntry) -> !metadataEntry.contains(expectedMetadataType))) {
throw new InvalidManifestMetadataException(Messages.MANIFEST_METADATA_INVALID_ENTRY.getErrorMessage());
}
-
return TOSCA_TYPE_PNF.equals(expectedMetadataType);
}
private void handleMetadataEntries(final Map<String, String> metadata) {
- getManifestMetadata(metadata).stream()
- .filter(requiredEntry -> !metadata.containsKey(requiredEntry))
- .forEach(requiredEntry ->
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MANIFEST_METADATA_MISSING_ENTRY.getErrorMessage(), requiredEntry)));
+ getManifestMetadata(metadata).stream().filter(requiredEntry -> !metadata.containsKey(requiredEntry)).forEach(
+ requiredEntry -> reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_METADATA_MISSING_ENTRY.getErrorMessage(), requiredEntry)));
}
/**
@@ -381,9 +354,7 @@ class SOL004MetaDirectoryValidator implements Validator {
final Set<String> packageFiles = contentHandler.getFileList();
final List<String> sources = internalFilesFilter.filter(onboardingManifest.getSources());
verifyFilesExist(packageFiles, sources, MANIFEST_SOURCE);
-
final Map<String, List<String>> nonManoArtifacts = onboardingManifest.getNonManoSources();
-
final List<String> nonManoValidFilePaths = new ArrayList<>();
nonManoArtifacts.forEach((nonManoType, files) -> {
final List<String> internalNonManoFileList = internalFilesFilter.filter(files);
@@ -397,9 +368,7 @@ class SOL004MetaDirectoryValidator implements Validator {
validateOnapCnfHelmNonManoEntry(files);
}
});
-
verifyFilesExist(packageFiles, nonManoValidFilePaths, MANIFEST_NON_MANO_SOURCE);
-
final Set<String> allReferredFiles = new HashSet<>();
allReferredFiles.addAll(sources);
allReferredFiles.addAll(nonManoValidFilePaths);
@@ -412,32 +381,25 @@ class SOL004MetaDirectoryValidator implements Validator {
return;
}
if (files.size() != 1) {
- final String formattedFileList = files.stream()
- .map(filePath -> String.format("'%s'", filePath))
- .collect(Collectors.joining(", "));
- reportError(ErrorLevel.ERROR,
- Messages.UNIQUE_SW_INFORMATION_NON_MANO_ERROR.formatMessage(formattedFileList));
+ final String formattedFileList = files.stream().map(filePath -> String.format("'%s'", filePath)).collect(Collectors.joining(", "));
+ reportError(ErrorLevel.ERROR, Messages.UNIQUE_SW_INFORMATION_NON_MANO_ERROR.formatMessage(formattedFileList));
return;
}
final String swInformationFilePath = files.get(0);
final byte[] swInformationYaml = contentHandler.getFileContent(swInformationFilePath);
- final Optional<PnfSoftwareInformation> parsedYaml = SoftwareInformationArtifactYamlParser
- .parse(swInformationYaml);
+ final Optional<PnfSoftwareInformation> parsedYaml = SoftwareInformationArtifactYamlParser.parse(swInformationYaml);
if (!parsedYaml.isPresent()) {
- reportError(ErrorLevel.ERROR,
- Messages.INVALID_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
+ reportError(ErrorLevel.ERROR, Messages.INVALID_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
} else {
final PnfSoftwareInformation pnfSoftwareInformation = parsedYaml.get();
if (!pnfSoftwareInformation.isValid()) {
- reportError(ErrorLevel.ERROR,
- Messages.INCORRECT_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
+ reportError(ErrorLevel.ERROR, Messages.INCORRECT_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
}
}
}
/**
- * Validates if a YAML file has the correct extension, is not empty and the content is a valid YAML. Reports each
- * error found.
+ * Validates if a YAML file has the correct extension, is not empty and the content is a valid YAML. Reports each error found.
*
* @param filePath the file path inside the package
*/
@@ -450,7 +412,6 @@ class SOL004MetaDirectoryValidator implements Validator {
reportError(ErrorLevel.ERROR, Messages.INVALID_YAML_EXTENSION.formatMessage(filePath));
return;
}
-
try (final InputStream fileContent = contentHandler.getFileContentAsStream(filePath)) {
if (fileContent == null) {
reportError(ErrorLevel.ERROR, Messages.EMPTY_YAML_FILE_1.formatMessage(filePath));
@@ -477,8 +438,7 @@ class SOL004MetaDirectoryValidator implements Validator {
private void verifyFilesBeingReferred(final Set<String> referredFileSet, final Set<String> packageFileSet) {
packageFileSet.forEach(filePath -> {
if (!isManifestFile(filePath) && !referredFileSet.contains(filePath)) {
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MISSING_MANIFEST_REFERENCE.getErrorMessage(), filePath));
+ reportError(ErrorLevel.ERROR, String.format(Messages.MISSING_MANIFEST_REFERENCE.getErrorMessage(), filePath));
}
});
}
@@ -489,16 +449,14 @@ class SOL004MetaDirectoryValidator implements Validator {
private void validateOtherEntries(final String folderPath) {
if (!verifyFoldersExist(folderList, folderPath)) {
- reportError(ErrorLevel.ERROR, String.format(Messages.METADATA_MISSING_OPTIONAL_FOLDERS.getErrorMessage(),
- folderPath));
+ reportError(ErrorLevel.ERROR, String.format(Messages.METADATA_MISSING_OPTIONAL_FOLDERS.getErrorMessage(), folderPath));
}
}
private void validateCertificate(final String file) {
final Set<String> packageFiles = contentHandler.getFileList();
if (!verifyFileExist(packageFiles, file)) {
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MISSING_METADATA_FILES.getErrorMessage(), file, file));
+ reportError(ErrorLevel.ERROR, String.format(Messages.MISSING_METADATA_FILES.getErrorMessage(), file, file));
}
}
@@ -509,8 +467,7 @@ class SOL004MetaDirectoryValidator implements Validator {
private void verifyFilesExist(final Set<String> existingFiles, final List<String> sources, final String type) {
sources.forEach(file -> {
if (!existingFiles.contains(file)) {
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MISSING_MANIFEST_SOURCE.getErrorMessage(), type, file));
+ reportError(ErrorLevel.ERROR, String.format(Messages.MISSING_MANIFEST_SOURCE.getErrorMessage(), type, file));
}
});
}
@@ -552,10 +509,8 @@ class SOL004MetaDirectoryValidator implements Validator {
}
private void validatePmDictionaryContentsAgainstSchema() {
- final Stream<byte[]> pmDictionaryFiles = new FileExtractor(getEtsiEntryManifestPath(), contentHandler)
- .findFiles(ONAP_PM_DICTIONARY);
- new PMDictionaryValidator()
- .validate(pmDictionaryFiles, (String message) -> reportError(ErrorLevel.ERROR, message));
+ final Stream<byte[]> pmDictionaryFiles = new FileExtractor(getEtsiEntryManifestPath(), contentHandler).findFiles(ONAP_PM_DICTIONARY);
+ new PMDictionaryValidator().validate(pmDictionaryFiles, (String message) -> reportError(ErrorLevel.ERROR, message));
}
private String getEtsiEntryManifestPath() {
@@ -564,6 +519,7 @@ class SOL004MetaDirectoryValidator implements Validator {
/**
* Validates if onap_cnf_helm non_mano type points to a file
+ *
* @param files
*/
private void validateOnapCnfHelmNonManoEntry(final List<String> files) {
@@ -572,11 +528,8 @@ class SOL004MetaDirectoryValidator implements Validator {
return;
}
if (files.size() != 1) {
- final String formattedFileList = files.stream()
- .map(filePath -> String.format("'%s'", filePath))
- .collect(Collectors.joining(", "));
- reportError(ErrorLevel.ERROR,
- Messages.UNIQUE_ONAP_CNF_HELM_NON_MANO_ERROR.formatMessage(formattedFileList));
+ final String formattedFileList = files.stream().map(filePath -> String.format("'%s'", filePath)).collect(Collectors.joining(", "));
+ reportError(ErrorLevel.ERROR, Messages.UNIQUE_ONAP_CNF_HELM_NON_MANO_ERROR.formatMessage(formattedFileList));
}
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java
index 9e380a355c..12d5ecfff9 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java
@@ -36,8 +36,8 @@ import org.openecomp.sdc.tosca.csar.ToscaMetaEntry;
import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager;
/**
- * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure
- * as defined in ETSI GS NFV-SOL 004 v3.3.1.
+ * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure as defined in ETSI GS NFV-SOL
+ * 004 v3.3.1.
*/
class SOL004Version3MetaDirectoryValidator extends SOL004MetaDirectoryValidator {
@@ -56,8 +56,9 @@ class SOL004Version3MetaDirectoryValidator extends SOL004MetaDirectoryValidator
if (!ToscaMetaEntry.OTHER_DEFINITIONS.getName().equals(entry.getKey())) {
reportError(ErrorLevel.ERROR, Messages.METADATA_UNSUPPORTED_ENTRY.formatMessage(entry.getKey()));
LOGGER.warn(Messages.METADATA_UNSUPPORTED_ENTRY.getErrorMessage(), entry.getKey());
- } else
+ } else {
validateDefinitionFile(entry.getValue());
+ }
}
@Override
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version4MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version4MetaDirectoryValidator.java
index 701abfc677..31c19d7794 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version4MetaDirectoryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version4MetaDirectoryValidator.java
@@ -36,8 +36,8 @@ import org.openecomp.sdc.tosca.csar.ToscaMetaEntry;
import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager;
/**
- * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure
- * as defined in ETSI GS NFV-SOL 004 v3.3.1 with CNF Enhancements from ETSI GS NFV-SOL 004 v4.1.1
+ * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure as defined in ETSI GS NFV-SOL
+ * 004 v3.3.1 with CNF Enhancements from ETSI GS NFV-SOL 004 v4.1.1
*/
class SOL004Version4MetaDirectoryValidator extends SOL004MetaDirectoryValidator {
@@ -78,5 +78,4 @@ class SOL004Version4MetaDirectoryValidator extends SOL004MetaDirectoryValidator
validateDefinitionFile(entry.getValue());
}
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/Validator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/Validator.java
index 34386b6d29..e8f88c7eba 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/Validator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/Validator.java
@@ -17,22 +17,19 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
-import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.sdc.datatypes.error.ErrorMessage;
import java.util.List;
import java.util.Map;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
/**
* Validates the contents of the CSAR package uploaded in SDC.
*/
-
public interface Validator {
/**
- *
* @param contentHandler contains file and its data
* @return errors Map of errors that occur
*/
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java
index 9d218190d8..27a1852644 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactory.java
@@ -17,7 +17,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
import static org.openecomp.sdc.tosca.csar.CSARConstants.ETSI_VERSION_2_7_1;
@@ -29,8 +28,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIServiceImp
public class ValidatorFactory {
- private ValidatorFactory(){
-
+ private ValidatorFactory() {
}
/**
@@ -45,7 +43,7 @@ public class ValidatorFactory {
if (!etsiService.isSol004WithToscaMetaDirectory(fileContentHandler)) {
return new ONAPCsarValidator();
}
- if (!etsiService.getHighestCompatibleSpecificationVersion(fileContentHandler).isLowerThan(ETSI_VERSION_2_7_1)){
+ if (!etsiService.getHighestCompatibleSpecificationVersion(fileContentHandler).isLowerThan(ETSI_VERSION_2_7_1)) {
if (etsiService.hasCnfEnhancements(fileContentHandler)) {
return new SOL004Version4MetaDirectoryValidator();
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/exception/MissingCertificateException.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/exception/MissingCertificateException.java
index 620ff345ad..e3d91e01df 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/exception/MissingCertificateException.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/exception/MissingCertificateException.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.exception;
public class MissingCertificateException extends RuntimeException {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java
index c6d7d637fa..bfef0b4471 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java
@@ -48,8 +48,7 @@ public class FileExtractor {
Map<String, List<String>> nonManoSources = extractNonManoSources();
List<String> pathsToSources = nonManoSources.getOrDefault(fileType.getType(), new ArrayList<>());
List<String> pathsToLocalFiles = internalFilesFilter.filter(pathsToSources);
- return pathsToLocalFiles.stream()
- .map(contentHandler::getFileContent);
+ return pathsToLocalFiles.stream().map(contentHandler::getFileContent);
}
private Map<String, List<String>> extractNonManoSources() {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java
index 50dcd0ce29..ce119f6a6f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java
@@ -25,9 +25,7 @@ import java.util.stream.Collectors;
public class InternalFilesFilter {
public List<String> filter(final List<String> sources) {
- return sources.stream()
- .filter(this::isInternalFile)
- .collect(Collectors.toList());
+ return sources.stream().filter(this::isInternalFile).collect(Collectors.toList());
}
private boolean isInternalFile(final String filePath) {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/ValidatorUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/ValidatorUtils.java
index cfdd53774f..d260b1272b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/ValidatorUtils.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/ValidatorUtils.java
@@ -17,7 +17,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils;
import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_TYPE_PNF;
@@ -32,15 +31,11 @@ import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.exceptions.Inv
public class ValidatorUtils {
public boolean isPnfMetadata(List<String> keys) {
- keys = keys.stream().filter(key -> !COMPATIBLE_SPECIFICATION_VERSIONS.getToken().equals(key))
- .collect(Collectors.toList());
- final String expectedMetadataType =
- keys.get(0).contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
- if (keys.stream()
- .anyMatch(k -> !k.startsWith(expectedMetadataType))) {
+ keys = keys.stream().filter(key -> !COMPATIBLE_SPECIFICATION_VERSIONS.getToken().equals(key)).collect(Collectors.toList());
+ final String expectedMetadataType = keys.get(0).contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
+ if (keys.stream().anyMatch(k -> !k.startsWith(expectedMetadataType))) {
throw new InvalidManifestMetadataException(Messages.MANIFEST_METADATA_INVALID_ENTRY.getErrorMessage());
}
return expectedMetadataType.equals(TOSCA_TYPE_PNF);
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/InvalidManifestMetadataException.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/InvalidManifestMetadataException.java
index 137891c0c9..1204a73509 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/InvalidManifestMetadataException.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/InvalidManifestMetadataException.java
@@ -17,12 +17,11 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.exceptions;
-public class InvalidManifestMetadataException extends RuntimeException{
+public class InvalidManifestMetadataException extends RuntimeException {
- public InvalidManifestMetadataException(String message){
+ public InvalidManifestMetadataException(String message) {
super(message);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/OrchestrationTemplateHandlerException.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/OrchestrationTemplateHandlerException.java
index a8a9105254..3f47915fdd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/OrchestrationTemplateHandlerException.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/exceptions/OrchestrationTemplateHandlerException.java
@@ -17,12 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.exceptions;
-public class OrchestrationTemplateHandlerException extends RuntimeException{
+public class OrchestrationTemplateHandlerException extends RuntimeException {
- public OrchestrationTemplateHandlerException(String message, Throwable throwable){
+ public OrchestrationTemplateHandlerException(String message, Throwable throwable) {
super(message, throwable);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
index 0ac093240d..0b222fd51d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
@@ -13,9 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
import org.onap.config.api.Configuration;
import org.onap.config.api.ConfigurationManager;
import org.openecomp.core.utilities.CommonMethods;
@@ -23,49 +27,39 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
import org.openecomp.sdc.vendorsoftwareproduct.types.ConfigConstants;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
public class OrchestrationProcessFactory {
- private static final Map<String, ImplementationConfiguration> PROCESS_IMPL_MAP;
- private OrchestrationProcessFactory() {
-
- }
-
- static {
- Configuration config = ConfigurationManager.lookup();
- PROCESS_IMPL_MAP = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
- ConfigConstants.PROCESS_IMPL_KEY, ImplementationConfiguration.class));
+ private static final Map<String, ImplementationConfiguration> PROCESS_IMPL_MAP;
- }
-
- public static Optional<OrchestrationTemplateProcessHandler> getInstance(String fileSuffix) {
-
- if (fileSuffix == null) {
- return Optional.empty();
+ static {
+ Configuration config = ConfigurationManager.lookup();
+ PROCESS_IMPL_MAP = new ConcurrentHashMap<>(
+ config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE, ConfigConstants.PROCESS_IMPL_KEY, ImplementationConfiguration.class));
}
- String updatedFileSuffix = fileSuffix;
- updatedFileSuffix = updatedFileSuffix.toLowerCase().trim();
- OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(updatedFileSuffix);
- if (onboardingTypesEnum == null) {
- return Optional.empty();
+
+ private OrchestrationProcessFactory() {
}
- try {
- return Optional.of(createInstance(PROCESS_IMPL_MAP.get(onboardingTypesEnum.toString())));
- }catch (Exception e){
- return Optional.empty();
+ public static Optional<OrchestrationTemplateProcessHandler> getInstance(String fileSuffix) {
+ if (fileSuffix == null) {
+ return Optional.empty();
+ }
+ String updatedFileSuffix = fileSuffix;
+ updatedFileSuffix = updatedFileSuffix.toLowerCase().trim();
+ OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(updatedFileSuffix);
+ if (onboardingTypesEnum == null) {
+ return Optional.empty();
+ }
+ try {
+ return Optional.of(createInstance(PROCESS_IMPL_MAP.get(onboardingTypesEnum.toString())));
+ } catch (Exception e) {
+ return Optional.empty();
+ }
}
- }
- private static OrchestrationTemplateProcessHandler createInstance(ImplementationConfiguration implClass)
- throws Exception {
- OrchestrationTemplateProcessHandler handler;
- handler =
- CommonMethods.newInstance(implClass.getImplementationClass(), OrchestrationTemplateProcessHandler.class);
- return handler;
- }
+ private static OrchestrationTemplateProcessHandler createInstance(ImplementationConfiguration implClass) throws Exception {
+ OrchestrationTemplateProcessHandler handler;
+ handler = CommonMethods.newInstance(implClass.getImplementationClass(), OrchestrationTemplateProcessHandler.class);
+ return handler;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
index 38508c6ec3..8778e0b56b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
import java.io.ByteArrayInputStream;
@@ -58,125 +57,107 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTemplateProcessHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
- private static final String SDC_ONBOARDED_PACKAGE_DIR = "Deployment/" + ArtifactTypeEnum.ETSI_PACKAGE.getType() + "/";
- private static final String EXT_SEPARATOR = ".";
- private final CandidateService candidateService = CandidateServiceFactory.getInstance().createInterface();
- private final ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
-
- @Override
- public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData) {
-
-
- UploadFileResponse uploadFileResponse = new UploadFileResponse();
- Optional<FileContentHandler> fileContent = OrchestrationUtil
- .getFileContentMap(OnboardingTypesEnum.CSAR, uploadFileResponse,
- candidateData.getContentData().array());
-
- OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
- if (fileContent.isPresent()) {
- try {
- FileContentHandler fileContentHandler = fileContent.get();
- processCsar(vspDetails, fileContentHandler, candidateData, response);
- } catch (CoreException e) {
- LOGGER.error(e.getMessage(), e);
- response.addErrorMessageToMap(e.code().id(), e.code().message(),ErrorLevel.ERROR);
- }catch (IOException e){
- LOGGER.error(e.getMessage(), e);
- response.addErrorMessageToMap(SdcCommon.PROCESS_FILE, e.getMessage(), ErrorLevel.ERROR);
- }
- } else {
- if (!uploadFileResponse.getErrors().isEmpty()) {
- response.addStructureErrors(uploadFileResponse.getErrors());
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
+ private static final String SDC_ONBOARDED_PACKAGE_DIR = "Deployment/" + ArtifactTypeEnum.ETSI_PACKAGE.getType() + "/";
+ private static final String EXT_SEPARATOR = ".";
+ private final CandidateService candidateService = CandidateServiceFactory.getInstance().createInterface();
+ private final ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
+
+ @Override
+ public OrchestrationTemplateActionResponse process(VspDetails vspDetails, OrchestrationTemplateCandidateData candidateData) {
+ UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ Optional<FileContentHandler> fileContent = OrchestrationUtil
+ .getFileContentMap(OnboardingTypesEnum.CSAR, uploadFileResponse, candidateData.getContentData().array());
+ OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
+ if (fileContent.isPresent()) {
+ try {
+ FileContentHandler fileContentHandler = fileContent.get();
+ processCsar(vspDetails, fileContentHandler, candidateData, response);
+ } catch (CoreException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.addErrorMessageToMap(e.code().id(), e.code().message(), ErrorLevel.ERROR);
+ } catch (IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ response.addErrorMessageToMap(SdcCommon.PROCESS_FILE, e.getMessage(), ErrorLevel.ERROR);
+ }
+ } else {
+ if (!uploadFileResponse.getErrors().isEmpty()) {
+ response.addStructureErrors(uploadFileResponse.getErrors());
+ }
+ }
+ return response;
}
- return response;
- }
-
- private void processCsar(VspDetails vspDetails,
- FileContentHandler fileContentHandler,
- OrchestrationTemplateCandidateData candidateData,
- OrchestrationTemplateActionResponse response) throws IOException{
- response.setFileNames(new ArrayList<>(fileContentHandler.getFileList()));
- Map<String, List<ErrorMessage>> errors = validateCsar(fileContentHandler);
- toscaTreeManager.createTree();
- if (!isValid(errors)) {
- response.addStructureErrors(errors);
- toscaTreeManager.addErrors(errors);
- candidateService.updateValidationData(vspDetails.getId(), vspDetails.getVersion(),
- new ValidationStructureList(toscaTreeManager.getTree()));
- return;
+ private void processCsar(VspDetails vspDetails, FileContentHandler fileContentHandler, OrchestrationTemplateCandidateData candidateData,
+ OrchestrationTemplateActionResponse response) throws IOException {
+ response.setFileNames(new ArrayList<>(fileContentHandler.getFileList()));
+ Map<String, List<ErrorMessage>> errors = validateCsar(fileContentHandler);
+ toscaTreeManager.createTree();
+ if (!isValid(errors)) {
+ response.addStructureErrors(errors);
+ toscaTreeManager.addErrors(errors);
+ candidateService
+ .updateValidationData(vspDetails.getId(), vspDetails.getVersion(), new ValidationStructureList(toscaTreeManager.getTree()));
+ return;
+ }
+ HeatStructureTree tree = toscaTreeManager.getTree();
+ Map<String, String> componentsQuestionnaire = new HashMap<>();
+ Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
+ Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
+ Map<String, ProcessEntity> processArtifact = new HashMap<>();
+ OrchestrationUtil orchestrationUtil = new OrchestrationUtil();
+ orchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspDetails.getId(), vspDetails.getVersion(), componentsQuestionnaire,
+ componentNicsQuestionnaire, componentMibList, processes, processArtifact);
+ Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
+ .fetchZipFileByteArrayInputStream(vspDetails.getId(), candidateData, null, OnboardingTypesEnum.CSAR, errors);
+ orchestrationUtil.deleteUploadDataAndContent(vspDetails.getId(), vspDetails.getVersion());
+ zipByteArrayInputStream.ifPresent(
+ byteArrayInputStream -> orchestrationUtil.saveUploadData(vspDetails, candidateData, byteArrayInputStream, fileContentHandler, tree));
+ ETSIService etsiService = new ETSIServiceImpl();
+ ToscaServiceModel toscaServiceModel;
+ if (etsiService.isSol004WithToscaMetaDirectory(fileContentHandler)) {
+ if (OnboardingTypesEnum.CSAR.toString().equalsIgnoreCase(candidateData.getFileSuffix())) {
+ fileContentHandler
+ .addFile(SDC_ONBOARDED_PACKAGE_DIR + candidateData.getOriginalFileName() + EXT_SEPARATOR + candidateData.getOriginalFileSuffix(),
+ candidateData.getOriginalFileContentData().array());
+ } else {
+ fileContentHandler.addFile(SDC_ONBOARDED_PACKAGE_DIR + candidateData.getFileName() + EXT_SEPARATOR + candidateData.getFileSuffix(),
+ candidateData.getContentData().array());
+ }
+ final ResourceTypeEnum resourceType = etsiService.getResourceType(fileContentHandler);
+ toscaServiceModel = instantiateToscaConverterFor(resourceType).convert(fileContentHandler);
+ } else {
+ toscaServiceModel = new ToscaConverterImpl().convert(fileContentHandler);
+ }
+ orchestrationUtil.saveServiceModel(vspDetails.getId(), vspDetails.getVersion(), toscaServiceModel, toscaServiceModel);
+ candidateService.deleteOrchestrationTemplateCandidate(vspDetails.getId(), vspDetails.getVersion());
}
- HeatStructureTree tree = toscaTreeManager.getTree();
-
- Map<String, String> componentsQuestionnaire = new HashMap<>();
- Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
- Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
- Map<String, ProcessEntity> processArtifact = new HashMap<>();
- OrchestrationUtil orchestrationUtil = new OrchestrationUtil();
- orchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspDetails.getId(),
- vspDetails.getVersion(), componentsQuestionnaire,
- componentNicsQuestionnaire, componentMibList, processes, processArtifact);
-
- Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
- .fetchZipFileByteArrayInputStream(vspDetails.getId(), candidateData, null,
- OnboardingTypesEnum.CSAR, errors);
-
- orchestrationUtil.deleteUploadDataAndContent(vspDetails.getId(), vspDetails.getVersion());
- zipByteArrayInputStream.ifPresent(byteArrayInputStream -> orchestrationUtil
- .saveUploadData(vspDetails, candidateData, byteArrayInputStream,
- fileContentHandler, tree));
-
- ETSIService etsiService = new ETSIServiceImpl();
- ToscaServiceModel toscaServiceModel;
- if (etsiService.isSol004WithToscaMetaDirectory(fileContentHandler)) {
- if (OnboardingTypesEnum.CSAR.toString().equalsIgnoreCase(candidateData.getFileSuffix())) {
- fileContentHandler.addFile(SDC_ONBOARDED_PACKAGE_DIR + candidateData.getOriginalFileName() +
- EXT_SEPARATOR + candidateData.getOriginalFileSuffix(), candidateData.getOriginalFileContentData().array());
- } else {
- fileContentHandler.addFile(SDC_ONBOARDED_PACKAGE_DIR + candidateData.getFileName() +
- EXT_SEPARATOR + candidateData.getFileSuffix(), candidateData.getContentData().array());
- }
- final ResourceTypeEnum resourceType = etsiService.getResourceType(fileContentHandler);
- toscaServiceModel = instantiateToscaConverterFor(resourceType).convert(fileContentHandler);
- } else {
- toscaServiceModel = new ToscaConverterImpl().convert(fileContentHandler);
+ private AbstractToscaSolConverter instantiateToscaConverterFor(ResourceTypeEnum resourceType) {
+ if (resourceType == ResourceTypeEnum.PNF) {
+ return new ToscaSolModelDrivenConverterPnf();
+ }
+ // default is VF
+ return new ToscaSolConverterVnf();
}
- orchestrationUtil.saveServiceModel(vspDetails.getId(),
- vspDetails.getVersion(), toscaServiceModel,
- toscaServiceModel);
- candidateService
- .deleteOrchestrationTemplateCandidate(vspDetails.getId(), vspDetails.getVersion());
- }
- private AbstractToscaSolConverter instantiateToscaConverterFor(ResourceTypeEnum resourceType) {
- if (resourceType == ResourceTypeEnum.PNF) {
- return new ToscaSolModelDrivenConverterPnf();
+ private void addFiles(FileContentHandler fileContentHandler) {
+ for (Map.Entry<String, byte[]> fileEntry : fileContentHandler.getFiles().entrySet()) {
+ toscaTreeManager.addFile(fileEntry.getKey(), fileEntry.getValue());
+ }
}
- // default is VF
- return new ToscaSolConverterVnf();
- }
- private void addFiles(FileContentHandler fileContentHandler) {
- for (Map.Entry<String, byte[]> fileEntry : fileContentHandler.getFiles().entrySet()) {
- toscaTreeManager.addFile(fileEntry.getKey(), fileEntry.getValue());
+ private Map<String, List<ErrorMessage>> validateCsar(FileContentHandler fileContentHandler) {
+ Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ addFiles(fileContentHandler);
+ toscaTreeManager.createTree();
+ toscaTreeManager.addErrors(errors);
+ //todo - add tosca validation here to the existing validation framework
+ return errors;
}
- }
-
- private Map<String, List<ErrorMessage>> validateCsar(FileContentHandler fileContentHandler) {
- Map<String, List<ErrorMessage>> errors = new HashMap<>();
- addFiles(fileContentHandler);
- toscaTreeManager.createTree();
- toscaTreeManager.addErrors(errors);
- //todo - add tosca validation here to the existing validation framework
- return errors;
- }
- private boolean isValid(Map<String, List<ErrorMessage>> errors) {
- return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, errors));
- }
+ private boolean isValid(Map<String, List<ErrorMessage>> errors) {
+ return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, errors));
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java
index c775ac2c84..ae555b78a0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
-
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
@@ -24,6 +22,5 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateAction
@FunctionalInterface
public interface OrchestrationTemplateProcessHandler {
- OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData);
+ OrchestrationTemplateActionResponse process(VspDetails vspDetails, OrchestrationTemplateCandidateData candidateData);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
index 2d18a62122..5f18cb2faa 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
@@ -14,9 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
@@ -37,7 +46,11 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
import org.openecomp.sdc.validation.util.ValidationManagerUtil;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.*;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
@@ -47,157 +60,119 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStru
import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.*;
-
public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemplateProcessHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class);
- private final CandidateService candidateService =
- CandidateServiceFactory.getInstance().createInterface();
-
- @Override
- public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData) {
- String vspId = vspDetails.getId();
- Version version = vspDetails.getVersion();
- OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
- UploadFileResponse uploadFileResponse = new UploadFileResponse();
- Optional<FileContentHandler> fileContent = OrchestrationUtil
- .getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse,
- candidateData.getContentData().array());
- if (!fileContent.isPresent()) {
- response.addStructureErrors(uploadFileResponse.getErrors());
- return response;
- }
-
- Map<String, List<ErrorMessage>> uploadErrors = uploadFileResponse.getErrors();
- FileContentHandler fileContentMap = fileContent.get();
- try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
- addDummyHeatBase(zipFileManifest ,fileContentMap);
- } catch (Exception e) {
- LOGGER.error("Invalid package content", e);
- }
- FilesDataStructure structure =
- JsonUtil.json2Object(candidateData.getFilesDataStructure(), FilesDataStructure.class);
-
- if (CollectionUtils.isNotEmpty(structure.getUnassigned())) {
- response.addErrorMessageToMap(SdcCommon.UPLOAD_FILE,
- Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR);
- return response;
- }
-
-
- ManifestContent zipManifestFile = readManifestFromZip(fileContentMap);
- String manifest = null;
- if (zipManifestFile == null) {
- manifest = candidateService.createManifest(vspDetails, structure);
- } else {
- manifest = candidateService.createManifestFromExisting(vspDetails, structure, zipManifestFile);
+ private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class);
+ private final CandidateService candidateService = CandidateServiceFactory.getInstance().createInterface();
+
+ @Override
+ public OrchestrationTemplateActionResponse process(VspDetails vspDetails, OrchestrationTemplateCandidateData candidateData) {
+ String vspId = vspDetails.getId();
+ Version version = vspDetails.getVersion();
+ OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
+ UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ Optional<FileContentHandler> fileContent = OrchestrationUtil
+ .getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, candidateData.getContentData().array());
+ if (!fileContent.isPresent()) {
+ response.addStructureErrors(uploadFileResponse.getErrors());
+ return response;
+ }
+ Map<String, List<ErrorMessage>> uploadErrors = uploadFileResponse.getErrors();
+ FileContentHandler fileContentMap = fileContent.get();
+ try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
+ addDummyHeatBase(zipFileManifest, fileContentMap);
+ } catch (Exception e) {
+ LOGGER.error("Invalid package content", e);
+ }
+ FilesDataStructure structure = JsonUtil.json2Object(candidateData.getFilesDataStructure(), FilesDataStructure.class);
+ if (CollectionUtils.isNotEmpty(structure.getUnassigned())) {
+ response.addErrorMessageToMap(SdcCommon.UPLOAD_FILE, Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR);
+ return response;
+ }
+ ManifestContent zipManifestFile = readManifestFromZip(fileContentMap);
+ String manifest = null;
+ if (zipManifestFile == null) {
+ manifest = candidateService.createManifest(vspDetails, structure);
+ } else {
+ manifest = candidateService.createManifestFromExisting(vspDetails, structure, zipManifestFile);
+ }
+ fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes());
+ Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
+ .fetchZipFileByteArrayInputStream(vspId, candidateData, manifest, OnboardingTypesEnum.ZIP, uploadErrors);
+ if (!zipByteArrayInputStream.isPresent()) {
+ return response;
+ }
+ HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
+ Map<String, List<ErrorMessage>> errors = getErrors(response);
+ if (MapUtils.isNotEmpty(errors)) {
+ response.addStructureErrors(errors);
+ candidateService.updateValidationData(vspId, version, new ValidationStructureList(tree));
+ return response;
+ }
+ Map<String, String> componentsQuestionnaire = new HashMap<>();
+ Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
+ Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
+ Map<String, ProcessEntity> processArtifact = new HashMap<>();
+ OrchestrationUtil orchestrationUtil = new OrchestrationUtil();
+ Map<String, String> vspComponentIdNameInfoBeforeProcess = orchestrationUtil.getVspComponentIdNameInfo(vspId, version);
+ Collection<ComponentDependencyModelEntity> componentDependenciesBeforeDelete = orchestrationUtil
+ .getComponentDependenciesBeforeDelete(vspId, version);
+ orchestrationUtil
+ .backupComponentsQuestionnaireBeforeDelete(vspId, version, componentsQuestionnaire, componentNicsQuestionnaire, componentMibList,
+ processes, processArtifact);
+ orchestrationUtil.deleteUploadDataAndContent(vspId, version);
+ orchestrationUtil.saveUploadData(vspDetails, candidateData, zipByteArrayInputStream.get(), fileContentMap, tree);
+ TranslatorOutput translatorOutput = HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap);
+ ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
+ orchestrationUtil.saveServiceModel(vspId, version, translatorOutput.getNonUnifiedToscaServiceModel(), toscaServiceModel);
+ orchestrationUtil
+ .retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire, componentNicsQuestionnaire, componentMibList, processes,
+ processArtifact);
+ orchestrationUtil.updateVspComponentDependencies(vspId, version, vspComponentIdNameInfoBeforeProcess, componentDependenciesBeforeDelete);
+ uploadFileResponse.addStructureErrors(uploadErrors);
+ candidateService.deleteOrchestrationTemplateCandidate(vspId, version);
+ return response;
}
- fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes());
- Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
- .fetchZipFileByteArrayInputStream(
- vspId, candidateData, manifest, OnboardingTypesEnum.ZIP, uploadErrors);
- if (!zipByteArrayInputStream.isPresent()) {
- return response;
+ private ManifestContent readManifestFromZip(FileContentHandler fileContentMap) {
+ ManifestContent zipManifestFile = null;
+ try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
+ zipManifestFile = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
+ } catch (Exception e) {
+ LOGGER.error("Invalid package content", e);
+ }
+ return zipManifestFile;
}
- HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
- Map<String, List<ErrorMessage>> errors = getErrors(response);
- if (MapUtils.isNotEmpty(errors)) {
- response.addStructureErrors(errors);
- candidateService.updateValidationData(vspId, version, new ValidationStructureList(tree));
- return response;
+ private FileContentHandler addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
+ ManifestContent manifestContent = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
+ for (FileData fileData : manifestContent.getData()) {
+ if (Objects.nonNull(fileData.getType()) && fileData.getType().equals(FileData.Type.HELM) && fileData.getBase()) {
+ String filePath = new File("").getAbsolutePath() + "/resources";
+ File envFilePath = new File(filePath + "/base_template.env");
+ File baseFilePath = new File(filePath + "/base_template.yaml");
+ try (InputStream envStream = new FileInputStream(envFilePath); InputStream baseStream = new FileInputStream(baseFilePath);) {
+ fileContentMap.addFile("base_template_dummy_ignore.env", envStream);
+ fileContentMap.addFile("base_template_dummy_ignore.yaml", baseStream);
+ } catch (Exception e) {
+ LOGGER.error("File not found error {}", e);
+ }
+ }
+ }
+ return fileContentMap;
}
- Map<String, String> componentsQuestionnaire = new HashMap<>();
- Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
- Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
- Map<String, ProcessEntity> processArtifact = new HashMap<>();
-
- OrchestrationUtil orchestrationUtil = new OrchestrationUtil();
- Map<String, String> vspComponentIdNameInfoBeforeProcess =
- orchestrationUtil.getVspComponentIdNameInfo(vspId, version);
- Collection<ComponentDependencyModelEntity> componentDependenciesBeforeDelete =
- orchestrationUtil.getComponentDependenciesBeforeDelete(vspId, version);
- orchestrationUtil
- .backupComponentsQuestionnaireBeforeDelete(vspId, version, componentsQuestionnaire,
- componentNicsQuestionnaire, componentMibList, processes, processArtifact);
- orchestrationUtil.deleteUploadDataAndContent(vspId, version);
- orchestrationUtil
- .saveUploadData(vspDetails, candidateData, zipByteArrayInputStream.get(), fileContentMap,
- tree);
-
- TranslatorOutput translatorOutput =
- HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap);
-
- ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
- orchestrationUtil
- .saveServiceModel(vspId, version, translatorOutput.getNonUnifiedToscaServiceModel(),
- toscaServiceModel);
- orchestrationUtil.retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire,
- componentNicsQuestionnaire, componentMibList, processes, processArtifact);
- orchestrationUtil.updateVspComponentDependencies(vspId, version,
- vspComponentIdNameInfoBeforeProcess, componentDependenciesBeforeDelete);
-
- uploadFileResponse.addStructureErrors(uploadErrors);
- candidateService.deleteOrchestrationTemplateCandidate(vspId, version);
- return response;
- }
-
- private ManifestContent readManifestFromZip(FileContentHandler fileContentMap) {
- ManifestContent zipManifestFile = null;
- try (InputStream zipFileManifest = fileContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME)) {
- zipManifestFile = JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
- } catch (Exception e) {
- LOGGER.error("Invalid package content", e);
+ private Map<String, List<ErrorMessage>> getErrors(OrchestrationTemplateActionResponse orchestrationTemplateActionResponse) {
+ Map<String, List<ErrorMessage>> errors = MessageContainerUtil
+ .getMessageByLevel(ErrorLevel.ERROR, orchestrationTemplateActionResponse.getErrors());
+ return MapUtils.isEmpty(errors) ? null : orchestrationTemplateActionResponse.getErrors();
}
- return zipManifestFile;
- }
- private FileContentHandler addDummyHeatBase(InputStream zipFileManifest, FileContentHandler fileContentMap) {
- ManifestContent manifestContent =
- JsonUtil.json2Object(zipFileManifest, ManifestContent.class);
- for (FileData fileData : manifestContent.getData()) {
- if (Objects.nonNull(fileData.getType()) &&
- fileData.getType().equals(FileData.Type.HELM) && fileData.getBase()) {
- String filePath = new File("").getAbsolutePath() + "/resources";
- File envFilePath = new File(filePath + "/base_template.env");
- File baseFilePath = new File(filePath + "/base_template.yaml");
- try (
- InputStream envStream = new FileInputStream(envFilePath);
- InputStream baseStream = new FileInputStream(baseFilePath);) {
- fileContentMap.addFile("base_template_dummy_ignore.env", envStream);
- fileContentMap.addFile("base_template_dummy_ignore.yaml", baseStream);
- } catch (Exception e) {
- LOGGER.error("File not found error {}", e);
- }
- }
+ private HeatStructureTree createAndValidateHeatTree(OrchestrationTemplateActionResponse response, FileContentHandler fileContentMap) {
+ VendorSoftwareProductUtils.addFileNamesToUploadFileResponse(fileContentMap, response);
+ Map<String, List<ErrorMessage>> validationErrors = ValidationManagerUtil.initValidationManager(fileContentMap).validate();
+ response.getErrors().putAll(validationErrors);
+ return OrchestrationUtil.createHeatTree(fileContentMap, validationErrors);
}
- return fileContentMap;
- }
-
- private Map<String, List<ErrorMessage>> getErrors(OrchestrationTemplateActionResponse
- orchestrationTemplateActionResponse) {
- Map<String, List<ErrorMessage>> errors =
- MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR,
- orchestrationTemplateActionResponse.getErrors());
- return MapUtils.isEmpty(errors) ? null : orchestrationTemplateActionResponse.getErrors();
- }
-
- private HeatStructureTree createAndValidateHeatTree(OrchestrationTemplateActionResponse response,
- FileContentHandler fileContentMap) {
- VendorSoftwareProductUtils.addFileNamesToUploadFileResponse(fileContentMap, response);
- Map<String, List<ErrorMessage>> validationErrors =
- ValidationManagerUtil.initValidationManager(fileContentMap).validate();
- response.getErrors().putAll(validationErrors);
-
- return OrchestrationUtil.createHeatTree(fileContentMap, validationErrors);
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManager.java
index 006af058bb..d60b54b5e1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/security/SecurityManager.java
@@ -20,8 +20,13 @@
package org.openecomp.sdc.vendorsoftwareproduct.security;
import com.google.common.collect.ImmutableSet;
-
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
@@ -41,12 +46,11 @@ import java.security.cert.X509CertSelector;
import java.security.cert.X509Certificate;
import java.util.Collection;
import java.util.HashSet;
-import java.util.function.Predicate;
import java.util.Optional;
+import java.util.Set;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import java.util.Set;
-
import org.bouncycastle.asn1.cms.ContentInfo;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cms.CMSException;
@@ -62,16 +66,14 @@ import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
/**
- * This is temporary solution. When AAF provides functionality for verifying trustedCertificates, this class should be
- * reviewed Class is responsible for providing root trustedCertificates from configured location in onboarding
- * container.
+ * This is temporary solution. When AAF provides functionality for verifying trustedCertificates, this class should be reviewed Class is responsible
+ * for providing root trustedCertificates from configured location in onboarding container.
*/
public class SecurityManager {
private static final String CERTIFICATE_DEFAULT_LOCATION = "cert";
public static final Set<String> ALLOWED_SIGNATURE_EXTENSIONS = ImmutableSet.of("cms");
public static final Set<String> ALLOWED_CERTIFICATE_EXTENSIONS = ImmutableSet.of("cert", "crt");
-
private Logger logger = LoggerFactory.getLogger(SecurityManager.class);
private Set<X509Certificate> trustedCertificates = new HashSet<>();
private Set<X509Certificate> trustedCertificatesFromPackage = new HashSet<>();
@@ -87,7 +89,6 @@ public class SecurityManager {
certificateDirectory = this.getcertDirectory(System.getenv("SDC_CERT_DIR"));
}
-
// Package level constructor use in tests to avoid power mock
SecurityManager(String sdcCertDir) {
certificateDirectory = this.getcertDirectory(sdcCertDir);
@@ -123,8 +124,7 @@ public class SecurityManager {
processCertificateDir();
}
if (!trustedCertificatesFromPackage.isEmpty()) {
- return Stream.concat(trustedCertificatesFromPackage.stream(), trustedCertificates.stream())
- .collect(Collectors.toUnmodifiableSet());
+ return Stream.concat(trustedCertificatesFromPackage.stream(), trustedCertificates.stream()).collect(Collectors.toUnmodifiableSet());
}
return ImmutableSet.copyOf(trustedCertificates);
}
@@ -145,10 +145,10 @@ public class SecurityManager {
* @return true if signature verified
* @throws SecurityManagerException
*/
- public boolean verifySignedData(final byte[] messageSyntaxSignature, final byte[] packageCert,
- final byte[] innerPackageFile) throws SecurityManagerException {
- try (ByteArrayInputStream signatureStream = new ByteArrayInputStream(messageSyntaxSignature);
- final PEMParser pemParser = new PEMParser(new InputStreamReader(signatureStream))) {
+ public boolean verifySignedData(final byte[] messageSyntaxSignature, final byte[] packageCert, final byte[] innerPackageFile)
+ throws SecurityManagerException {
+ try (ByteArrayInputStream signatureStream = new ByteArrayInputStream(messageSyntaxSignature); final PEMParser pemParser = new PEMParser(
+ new InputStreamReader(signatureStream))) {
final Object parsedObject = pemParser.readObject();
if (!(parsedObject instanceof ContentInfo)) {
throw new SecurityManagerException("Signature is not recognized");
@@ -156,26 +156,23 @@ public class SecurityManager {
final ContentInfo signature = ContentInfo.getInstance(parsedObject);
final CMSTypedData signedContent = new CMSProcessableByteArray(innerPackageFile);
final CMSSignedData signedData = new CMSSignedData(signedContent, signature);
-
final Collection<SignerInformation> signers = signedData.getSignerInfos().getSigners();
final SignerInformation firstSigner = signers.iterator().next();
final X509Certificate cert;
Collection<X509CertificateHolder> certs;
if (packageCert == null) {
certs = signedData.getCertificates().getMatches(null);
- cert = readSignCert(certs, firstSigner).orElseThrow(() -> new SecurityManagerException(
- "No certificate found in cms signature that should contain one!"));
+ cert = readSignCert(certs, firstSigner)
+ .orElseThrow(() -> new SecurityManagerException("No certificate found in cms signature that should contain one!"));
} else {
certs = parseCertsFromPem(packageCert);
- cert = readSignCert(certs, firstSigner).orElseThrow(() -> new SecurityManagerException(
- "No matching certificate found in certificate file that should contain one!"));
+ cert = readSignCert(certs, firstSigner)
+ .orElseThrow(() -> new SecurityManagerException("No matching certificate found in certificate file that should contain one!"));
}
trustedCertificatesFromPackage = readTrustedCerts(certs, firstSigner);
-
if (verifyCertificate(cert, getTrustedCertificates()) == null) {
return false;
}
-
return firstSigner.verify(new JcaSimpleSignerInfoVerifierBuilder().build(cert));
} catch (OperatorCreationException | IOException | CMSException e) {
logger.error(e.getMessage(), e);
@@ -186,18 +183,12 @@ public class SecurityManager {
}
private Optional<X509Certificate> readSignCert(final Collection<X509CertificateHolder> certs, final SignerInformation firstSigner) {
- return certs.stream()
- .filter(crt -> firstSigner.getSID().match(crt))
- .findAny()
- .map(this::loadCertificate);
+ return certs.stream().filter(crt -> firstSigner.getSID().match(crt)).findAny().map(this::loadCertificate);
}
private Set<X509Certificate> readTrustedCerts(final Collection<X509CertificateHolder> certs, final SignerInformation firstSigner) {
- return certs.stream()
- .filter(crt -> !firstSigner.getSID().match(crt))
- .map(this::loadCertificate)
- .filter(Predicate.not(this::isSelfSigned))
- .collect(Collectors.toSet());
+ return certs.stream().filter(crt -> !firstSigner.getSID().match(crt)).map(this::loadCertificate).filter(Predicate.not(this::isSelfSigned))
+ .collect(Collectors.toSet());
}
private Set<X509CertificateHolder> parseCertsFromPem(final byte[] packageCert) throws IOException {
@@ -219,7 +210,6 @@ public class SecurityManager {
logger.error("Issue with certificate directory, check if exists!");
return;
}
-
File[] files = certificateDirectory.listFiles();
if (files == null) {
logger.error("Certificate directory is empty!");
@@ -238,10 +228,10 @@ public class SecurityManager {
return new File(certDirLocation);
}
- private X509Certificate loadCertificate(File certFile) throws SecurityManagerException {
+ private X509Certificate loadCertificate(File certFile) throws SecurityManagerException {
try (FileInputStream fi = new FileInputStream(certFile)) {
return loadCertificateFactory(fi);
- } catch(IOException e) {
+ } catch (IOException e) {
throw new SecurityManagerException("Error during loading Certificate from file!", e);
}
}
@@ -263,21 +253,17 @@ public class SecurityManager {
}
}
- private PKIXCertPathBuilderResult verifyCertificate(X509Certificate cert,
- Set<X509Certificate> additionalCerts)
- throws GeneralSecurityException, SecurityManagerException {
+ private PKIXCertPathBuilderResult verifyCertificate(X509Certificate cert, Set<X509Certificate> additionalCerts)
+ throws GeneralSecurityException, SecurityManagerException {
if (null == cert) {
throw new SecurityManagerException("The certificate is empty!");
}
-
if (isExpired(cert)) {
throw new SecurityManagerException("The certificate expired on: " + cert.getNotAfter());
}
-
if (isSelfSigned(cert)) {
throw new SecurityManagerException("The certificate is self-signed.");
}
-
Set<X509Certificate> trustedRootCerts = new HashSet<>();
Set<X509Certificate> intermediateCerts = new HashSet<>();
for (X509Certificate additionalCert : additionalCerts) {
@@ -287,25 +273,19 @@ public class SecurityManager {
intermediateCerts.add(additionalCert);
}
}
-
return verifyCertificate(cert, trustedRootCerts, intermediateCerts);
}
- private PKIXCertPathBuilderResult verifyCertificate(X509Certificate cert,
- Set<X509Certificate> allTrustedRootCerts,
- Set<X509Certificate> allIntermediateCerts)
- throws GeneralSecurityException {
-
+ private PKIXCertPathBuilderResult verifyCertificate(X509Certificate cert, Set<X509Certificate> allTrustedRootCerts,
+ Set<X509Certificate> allIntermediateCerts) throws GeneralSecurityException {
// Create the selector that specifies the starting certificate
X509CertSelector selector = new X509CertSelector();
selector.setCertificate(cert);
-
// Create the trust anchors (set of root CA certificates)
Set<TrustAnchor> trustAnchors = new HashSet<>();
for (X509Certificate trustedRootCert : allTrustedRootCerts) {
trustAnchors.add(new TrustAnchor(trustedRootCert, null));
}
-
// Configure the PKIX certificate builder algorithm parameters
PKIXBuilderParameters pkixParams;
try {
@@ -313,25 +293,20 @@ public class SecurityManager {
} catch (InvalidAlgorithmParameterException ex) {
throw new InvalidAlgorithmParameterException("No root CA has been found for this certificate", ex);
}
-
// Not supporting CRL checks for now
pkixParams.setRevocationEnabled(false);
-
Set<X509Certificate> certSet = new HashSet<>();
certSet.add(cert);
pkixParams.addCertStore(createCertStore(certSet));
pkixParams.addCertStore(createCertStore(allIntermediateCerts));
pkixParams.addCertStore(createCertStore(allTrustedRootCerts));
-
- CertPathBuilder builder = CertPathBuilder
- .getInstance(CertPathBuilder.getDefaultType(), BouncyCastleProvider.PROVIDER_NAME);
+ CertPathBuilder builder = CertPathBuilder.getInstance(CertPathBuilder.getDefaultType(), BouncyCastleProvider.PROVIDER_NAME);
return (PKIXCertPathBuilderResult) builder.build(pkixParams);
}
- private CertStore createCertStore(Set<X509Certificate> certificateSet) throws InvalidAlgorithmParameterException,
- NoSuchAlgorithmException, NoSuchProviderException {
- return CertStore.getInstance("Collection", new CollectionCertStoreParameters(certificateSet),
- BouncyCastleProvider.PROVIDER_NAME);
+ private CertStore createCertStore(Set<X509Certificate> certificateSet)
+ throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException {
+ return CertStore.getInstance("Collection", new CollectionCertStoreParameters(certificateSet), BouncyCastleProvider.PROVIDER_NAME);
}
private boolean isExpired(X509Certificate cert) {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java
index a8d528c503..ed38b61e81 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ComponentValidationResult.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,28 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
-
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
-
import java.util.Set;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
public class ComponentValidationResult {
- private boolean valid;
- private Set<CompositionEntityValidationData> validationData;
- public ComponentValidationResult(Set<CompositionEntityValidationData> validationData) {
- this.validationData = validationData;
- valid = validationData == null;
- }
+ private boolean valid;
+ private Set<CompositionEntityValidationData> validationData;
+
+ public ComponentValidationResult(Set<CompositionEntityValidationData> validationData) {
+ this.validationData = validationData;
+ valid = validationData == null;
+ }
- public boolean isValid() {
- return valid;
- }
+ public boolean isValid() {
+ return valid;
+ }
- public Set<CompositionEntityValidationData> getValidationData() {
- return validationData;
- }
+ public Set<CompositionEntityValidationData> getValidationData() {
+ return validationData;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java
index 24d28b198a..90518b93d0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,38 +17,37 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionDataEntity;
public class CompositionEntityResponse<T extends CompositionDataEntity> {
- private String id;
- private String schema;
- private T data;
+ private String id;
+ private String schema;
+ private T data;
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public void setId(String id) {
- this.id = id;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- public String getSchema() {
- return schema;
- }
+ public String getSchema() {
+ return schema;
+ }
- public void setSchema(String schema) {
- this.schema = schema;
- }
+ public void setSchema(String schema) {
+ this.schema = schema;
+ }
- public T getData() {
- return data;
- }
+ public T getData() {
+ return data;
+ }
- public void setData(T data) {
- this.data = data;
- }
+ public void setData(T data) {
+ this.data = data;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java
index 640d0c9bbc..35b6851a9b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
public class ConfigConstants {
- public static final String NAMESPACE = "Orchestration";
- public static final String PROCESS_IMPL_KEY = "process_impl";
- private ConfigConstants(){
+ public static final String NAMESPACE = "Orchestration";
+ public static final String PROCESS_IMPL_KEY = "process_impl";
- }
+ private ConfigConstants() {
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java
index bc24103779..5aca10294e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/DeploymentFlavorValidationResult.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,29 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
-
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
-
import java.util.Set;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
public class DeploymentFlavorValidationResult {
- private boolean valid;
- private Set<CompositionEntityValidationData> validationData;
- public DeploymentFlavorValidationResult(Set<CompositionEntityValidationData> validationData){
- this.validationData = validationData;
- valid = validationData == null;
- }
+ private boolean valid;
+ private Set<CompositionEntityValidationData> validationData;
- public boolean isValid() {
- return valid;
- }
+ public DeploymentFlavorValidationResult(Set<CompositionEntityValidationData> validationData) {
+ this.validationData = validationData;
+ valid = validationData == null;
+ }
- public Set<CompositionEntityValidationData> getValidationData() {
- return validationData;
- }
+ public boolean isValid() {
+ return valid;
+ }
+ public Set<CompositionEntityValidationData> getValidationData() {
+ return validationData;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java
index e5b8f7ff66..5911701bea 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import java.util.List;
@@ -27,22 +26,22 @@ import java.util.List;
*/
public class LicensingData {
- private String licenseAgreement;
- private List<String> featureGroups;
+ private String licenseAgreement;
+ private List<String> featureGroups;
- public String getLicenseAgreement() {
- return licenseAgreement;
- }
+ public String getLicenseAgreement() {
+ return licenseAgreement;
+ }
- public void setLicenseAgreement(String licenseAgreement) {
- this.licenseAgreement = licenseAgreement;
- }
+ public void setLicenseAgreement(String licenseAgreement) {
+ this.licenseAgreement = licenseAgreement;
+ }
- public List<String> getFeatureGroups() {
- return featureGroups;
- }
+ public List<String> getFeatureGroups() {
+ return featureGroups;
+ }
- public void setFeatureGroups(List<String> featureGroups) {
- this.featureGroups = featureGroups;
- }
+ public void setFeatureGroups(List<String> featureGroups) {
+ this.featureGroups = featureGroups;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java
index 21e0de7f17..226f0aeede 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ListComputeResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,32 +17,28 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
public class ListComputeResponse {
- private ComputeEntity computeEntity;
- private boolean associatedWithDeploymentFlavor;
-
- public boolean isAssociatedWithDeploymentFlavor() {
- return associatedWithDeploymentFlavor;
- }
-
- public void setAssociatedWithDeploymentFlavor(boolean associatedWithDeploymentFlavor) {
- this.associatedWithDeploymentFlavor = associatedWithDeploymentFlavor;
- }
+ private ComputeEntity computeEntity;
+ private boolean associatedWithDeploymentFlavor;
- public ComputeEntity getComputeEntity() {
- return computeEntity;
- }
+ public boolean isAssociatedWithDeploymentFlavor() {
+ return associatedWithDeploymentFlavor;
+ }
- public void setComputeEntity(
- ComputeEntity computeEntity) {
- this.computeEntity = computeEntity;
- }
+ public void setAssociatedWithDeploymentFlavor(boolean associatedWithDeploymentFlavor) {
+ this.associatedWithDeploymentFlavor = associatedWithDeploymentFlavor;
+ }
+ public ComputeEntity getComputeEntity() {
+ return computeEntity;
+ }
+ public void setComputeEntity(ComputeEntity computeEntity) {
+ this.computeEntity = computeEntity;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackage.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackage.java
index 1551cd8a1d..fc5306e892 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackage.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackage.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import java.nio.ByteBuffer;
@@ -43,8 +42,7 @@ public class OnboardPackage {
this.fileContentHandler = fileContentHandler;
}
- public OnboardPackage(final String filename, final String fileExtension, final ByteBuffer fileContent)
- throws OnboardPackageException {
+ public OnboardPackage(final String filename, final String fileExtension, final ByteBuffer fileContent) throws OnboardPackageException {
this.filename = filename;
this.fileExtension = fileExtension;
this.fileContent = fileContent;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java
index 6c35bd67d9..a78185e89f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import java.nio.ByteBuffer;
@@ -35,20 +34,17 @@ public class OnboardPackageInfo {
this(onboardPackage, onboardPackage, packageType);
}
- public OnboardPackageInfo(final OnboardPackage originalOnboardPackage,
- final OnboardPackage onboardPackage, final OnboardingTypesEnum packageType) {
+ public OnboardPackageInfo(final OnboardPackage originalOnboardPackage, final OnboardPackage onboardPackage,
+ final OnboardingTypesEnum packageType) {
this.packageType = packageType;
this.originalOnboardPackage = originalOnboardPackage;
this.onboardPackage = onboardPackage;
}
- public OnboardPackageInfo(final String filename,
- final String fileExtension,
- final ByteBuffer fileContent,
- final OnboardingTypesEnum packageType) throws OnboardPackageException {
+ public OnboardPackageInfo(final String filename, final String fileExtension, final ByteBuffer fileContent, final OnboardingTypesEnum packageType)
+ throws OnboardPackageException {
this.packageType = packageType;
originalOnboardPackage = new OnboardPackage(filename, fileExtension, fileContent);
this.onboardPackage = originalOnboardPackage;
}
-
-} \ No newline at end of file
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardSignedPackage.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardSignedPackage.java
index a1436fcd2d..e208610337 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardSignedPackage.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardSignedPackage.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import java.nio.ByteBuffer;
@@ -27,13 +26,14 @@ import org.openecomp.core.utilities.file.FileContentHandler;
@Getter
public class OnboardSignedPackage extends OnboardPackage {
+
private String signatureFilePath;
private String internalPackageFilePath;
private String certificateFilePath;
public OnboardSignedPackage(final String filename, final String fileExtension, final ByteBuffer fileContent,
- final FileContentHandler fileContentHandler, final String signatureFilePath,
- final String internalPackageFilePath, final String certificateFilePath) {
+ final FileContentHandler fileContentHandler, final String signatureFilePath, final String internalPackageFilePath,
+ final String certificateFilePath) {
super(filename, fileExtension, fileContent, fileContentHandler);
this.signatureFilePath = signatureFilePath;
this.internalPackageFilePath = internalPackageFilePath;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OrchestrationTemplateActionResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OrchestrationTemplateActionResponse.java
index cca20351bd..bdda2a22bd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OrchestrationTemplateActionResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OrchestrationTemplateActionResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,102 +17,95 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.datatypes.error.ErrorMessage;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
public class OrchestrationTemplateActionResponse {
- private List<String> fileNames;
- private Map<String, List<ErrorMessage>> errors = new HashMap<>();
- private UploadFileStatus status = UploadFileStatus.Success;
- public UploadFileStatus getStatus() {
- return status;
- }
+ private List<String> fileNames;
+ private Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ private UploadFileStatus status = UploadFileStatus.Success;
- public void setStatus(UploadFileStatus status) {
- this.status = status;
- }
-
- public List<String> getFileNames() {
- return fileNames;
- }
-
- public void setFileNames(List<String> fileNames) {
- this.fileNames = fileNames;
- }
+ public UploadFileStatus getStatus() {
+ return status;
+ }
- public void addNewFileToList(String filename) {
- this.fileNames.add(filename);
- }
+ public void setStatus(UploadFileStatus status) {
+ this.status = status;
+ }
- public void removeFileFromList(String toRemove) {
- this.fileNames.remove(toRemove);
- }
+ public List<String> getFileNames() {
+ return fileNames;
+ }
- /**
- * Add structure errors.
- *
- * @param errorsByFileName the errors by file name
- */
- public void addStructureErrors(Map<String, List<ErrorMessage>> errorsByFileName) {
- if (errorsByFileName == null) {
- return;
+ public void setFileNames(List<String> fileNames) {
+ this.fileNames = fileNames;
}
- errors.putAll(errorsByFileName);
+ public void addNewFileToList(String filename) {
+ this.fileNames.add(filename);
+ }
- if (status == UploadFileStatus.Failure) {
- return;
+ public void removeFileFromList(String toRemove) {
+ this.fileNames.remove(toRemove);
}
- for (Map.Entry<String, List<ErrorMessage>> entry : errorsByFileName.entrySet()) {
- for (ErrorMessage errorMessage : entry.getValue()) {
- if (errorMessage.getLevel() == ErrorLevel.ERROR) {
- status = UploadFileStatus.Failure;
- return;
+
+ /**
+ * Add structure errors.
+ *
+ * @param errorsByFileName the errors by file name
+ */
+ public void addStructureErrors(Map<String, List<ErrorMessage>> errorsByFileName) {
+ if (errorsByFileName == null) {
+ return;
+ }
+ errors.putAll(errorsByFileName);
+ if (status == UploadFileStatus.Failure) {
+ return;
+ }
+ for (Map.Entry<String, List<ErrorMessage>> entry : errorsByFileName.entrySet()) {
+ for (ErrorMessage errorMessage : entry.getValue()) {
+ if (errorMessage.getLevel() == ErrorLevel.ERROR) {
+ status = UploadFileStatus.Failure;
+ return;
+ }
+ }
}
- }
}
- }
- /**
- * Add error message to map.
- *
- * @param key the key
- * @param error the error
- * @param level the level
- */
- public void addErrorMessageToMap(String key, String error, ErrorLevel level) {
- ErrorMessage errorMessage = new ErrorMessage(level, error);
- List<ErrorMessage> errorMessages = getErrorList(key);
-
- errorMessages.add(errorMessage);
- this.errors.put(key, errorMessages);
-
- if (level.equals(ErrorLevel.ERROR)) {
- status = UploadFileStatus.Failure;
+ /**
+ * Add error message to map.
+ *
+ * @param key the key
+ * @param error the error
+ * @param level the level
+ */
+ public void addErrorMessageToMap(String key, String error, ErrorLevel level) {
+ ErrorMessage errorMessage = new ErrorMessage(level, error);
+ List<ErrorMessage> errorMessages = getErrorList(key);
+ errorMessages.add(errorMessage);
+ this.errors.put(key, errorMessages);
+ if (level.equals(ErrorLevel.ERROR)) {
+ status = UploadFileStatus.Failure;
+ }
}
- }
- private List<ErrorMessage> getErrorList(String key) {
- List<ErrorMessage> errorMessages = this.errors.get(key);
- if (CollectionUtils.isEmpty(errorMessages)) {
- errorMessages = new ArrayList<>();
+ private List<ErrorMessage> getErrorList(String key) {
+ List<ErrorMessage> errorMessages = this.errors.get(key);
+ if (CollectionUtils.isEmpty(errorMessages)) {
+ errorMessages = new ArrayList<>();
+ }
+ return errorMessages;
}
- return errorMessages;
- }
-
- public Map<String, List<ErrorMessage>> getErrors() {
- return errors;
- }
+ public Map<String, List<ErrorMessage>> getErrors() {
+ return errors;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java
index 3e7ef9f744..c0447c7cae 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,37 +17,37 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
public class QuestionnaireResponse {
- private String schema;
- private String data;
- private ErrorMessage errorMessage;
- public String getSchema() {
- return schema;
- }
+ private String schema;
+ private String data;
+ private ErrorMessage errorMessage;
+
+ public String getSchema() {
+ return schema;
+ }
- public void setSchema(String schema) {
- this.schema = schema;
- }
+ public void setSchema(String schema) {
+ this.schema = schema;
+ }
- public String getData() {
- return data;
- }
+ public String getData() {
+ return data;
+ }
- public void setData(String data) {
- this.data = data;
- }
+ public void setData(String data) {
+ this.data = data;
+ }
- public ErrorMessage getErrorMessage() {
- return errorMessage;
- }
+ public ErrorMessage getErrorMessage() {
+ return errorMessage;
+ }
- public void setErrorMessage(ErrorMessage errorMessage) {
- this.errorMessage = errorMessage;
- }
+ public void setErrorMessage(ErrorMessage errorMessage) {
+ this.errorMessage = errorMessage;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java
index 2599d4723d..9f2e9bd2ec 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,27 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
-
import java.util.Set;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
public class QuestionnaireValidationResult {
- private boolean valid;
- private Set<CompositionEntityValidationData> validationData;
- public QuestionnaireValidationResult(Set<CompositionEntityValidationData> validationData) {
- this.validationData = validationData;
- valid = validationData == null;
- }
+ private boolean valid;
+ private Set<CompositionEntityValidationData> validationData;
+
+ public QuestionnaireValidationResult(Set<CompositionEntityValidationData> validationData) {
+ this.validationData = validationData;
+ valid = validationData == null;
+ }
- public boolean isValid() {
- return valid;
- }
+ public boolean isValid() {
+ return valid;
+ }
- public Set<CompositionEntityValidationData> getValidationData() {
- return validationData;
- }
+ public Set<CompositionEntityValidationData> getValidationData() {
+ return validationData;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java
index 31bdf21884..0456692b71 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,101 +17,97 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
-
-import org.apache.commons.collections4.MapUtils;
-import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.datatypes.error.ErrorMessage;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
/**
* Created by TALIO on 4/27/2016.
*/
public class UploadFileResponse {
- private Map<String, List<ErrorMessage>> errors = new HashMap<>();
- private UploadFileStatus status = UploadFileStatus.Success;
- private OnboardingTypesEnum onboardingType;
- private String networkPackageName;
-
- public UploadFileStatus getStatus() {
- return status;
- }
-
- public void setStatus(UploadFileStatus status) {
- this.status = status;
- }
- public OnboardingTypesEnum getOnboardingType() {
- return onboardingType;
- }
+ private Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ private UploadFileStatus status = UploadFileStatus.Success;
+ private OnboardingTypesEnum onboardingType;
+ private String networkPackageName;
- public void setOnboardingType(OnboardingTypesEnum onboardingTypesEnum) {
- this.onboardingType = onboardingTypesEnum;
- }
-
- public String getNetworkPackageName() {
- return networkPackageName;
- }
+ public UploadFileStatus getStatus() {
+ return status;
+ }
- public void setNetworkPackageName(String networkPackageName) {
- this.networkPackageName = networkPackageName;
- }
+ public void setStatus(UploadFileStatus status) {
+ this.status = status;
+ }
- /**
- * Add structure error.
- *
- * @param fileName the file name
- * @param errorMessage the error message
- */
- public void addStructureError(String fileName, ErrorMessage errorMessage) {
- List<ErrorMessage> errorList = errors.get(fileName);
- if (errorList == null) {
- errorList = new ArrayList<>();
- errors.put(fileName, errorList);
+ public OnboardingTypesEnum getOnboardingType() {
+ return onboardingType;
}
- errorList.add(errorMessage);
- if (ErrorLevel.ERROR.equals(errorMessage.getLevel())) {
- status = UploadFileStatus.Failure;
+
+ public void setOnboardingType(OnboardingTypesEnum onboardingTypesEnum) {
+ this.onboardingType = onboardingTypesEnum;
}
- }
- /**
- * Add structure errors.
- *
- * @param errorsByFileName the errors by file name
- */
- public void addStructureErrors(Map<String, List<ErrorMessage>> errorsByFileName) {
- if (errorsByFileName == null) {
- return;
+ public String getNetworkPackageName() {
+ return networkPackageName;
}
- errors.putAll(errorsByFileName);
+ public void setNetworkPackageName(String networkPackageName) {
+ this.networkPackageName = networkPackageName;
+ }
- if (status == UploadFileStatus.Failure) {
- return;
+ /**
+ * Add structure error.
+ *
+ * @param fileName the file name
+ * @param errorMessage the error message
+ */
+ public void addStructureError(String fileName, ErrorMessage errorMessage) {
+ List<ErrorMessage> errorList = errors.get(fileName);
+ if (errorList == null) {
+ errorList = new ArrayList<>();
+ errors.put(fileName, errorList);
+ }
+ errorList.add(errorMessage);
+ if (ErrorLevel.ERROR.equals(errorMessage.getLevel())) {
+ status = UploadFileStatus.Failure;
+ }
}
- for (Map.Entry<String, List<ErrorMessage>> entry : errorsByFileName.entrySet()) {
- for (ErrorMessage errorMessage : entry.getValue()) {
- if (errorMessage.getLevel() == ErrorLevel.ERROR) {
- status = UploadFileStatus.Failure;
- return;
+
+ /**
+ * Add structure errors.
+ *
+ * @param errorsByFileName the errors by file name
+ */
+ public void addStructureErrors(Map<String, List<ErrorMessage>> errorsByFileName) {
+ if (errorsByFileName == null) {
+ return;
+ }
+ errors.putAll(errorsByFileName);
+ if (status == UploadFileStatus.Failure) {
+ return;
+ }
+ for (Map.Entry<String, List<ErrorMessage>> entry : errorsByFileName.entrySet()) {
+ for (ErrorMessage errorMessage : entry.getValue()) {
+ if (errorMessage.getLevel() == ErrorLevel.ERROR) {
+ status = UploadFileStatus.Failure;
+ return;
+ }
+ }
}
- }
}
- }
- public Map<String, List<ErrorMessage>> getErrors() {
- return errors;
- }
+ public Map<String, List<ErrorMessage>> getErrors() {
+ return errors;
+ }
- public boolean hasErrors() {
- return !MapUtils.isEmpty(errors);
- }
+ public boolean hasErrors() {
+ return !MapUtils.isEmpty(errors);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java
index 2bd8d76a66..231111b0f9 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
public enum UploadFileStatus {
- Success,
- Failure
+ Success, Failure
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java
index 525d627f4f..45a439fa61 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
import java.util.List;
@@ -27,17 +26,17 @@ import java.util.List;
*/
public class UploadFileStructure {
- private List<String> fileNames;
+ private List<String> fileNames;
- public List<String> getFileNames() {
- return fileNames;
- }
+ public List<String> getFileNames() {
+ return fileNames;
+ }
- public void setFileNames(List<String> fileNames) {
- this.fileNames = fileNames;
- }
+ public void setFileNames(List<String> fileNames) {
+ this.fileNames = fileNames;
+ }
- public void addNewFileToList(String filename) {
- this.fileNames.add(filename);
- }
+ public void addNewFileToList(String filename) {
+ this.fileNames.add(filename);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
index cab205c212..4ec6027c26 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java
@@ -13,96 +13,92 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
public class ValidationResponse {
- private boolean valid = true;
- private Collection<ErrorCode> vspErrors;
- private Collection<ErrorCode> licensingDataErrors;
- private Map<String, List<ErrorMessage>> uploadDataErrors;
- private QuestionnaireValidationResult questionnaireValidationResult;
- public boolean isValid() {
- return valid;
- }
+ private boolean valid = true;
+ private Collection<ErrorCode> vspErrors;
+ private Collection<ErrorCode> licensingDataErrors;
+ private Map<String, List<ErrorMessage>> uploadDataErrors;
+ private QuestionnaireValidationResult questionnaireValidationResult;
- public Collection<ErrorCode> getVspErrors() {
- return vspErrors;
- }
-
- /**
- * Sets vsp errors.
- * @param vspErrors the vsp errors
- */
- public void setVspErrors(Collection<ErrorCode> vspErrors) {
- this.vspErrors = vspErrors;
- if (CollectionUtils.isNotEmpty(vspErrors)) {
- valid = false;
+ public boolean isValid() {
+ return valid;
}
- VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors);
- }
-
+ public Collection<ErrorCode> getVspErrors() {
+ return vspErrors;
+ }
- public Collection<ErrorCode> getLicensingDataErrors() {
- return licensingDataErrors;
- }
+ /**
+ * Sets vsp errors.
+ *
+ * @param vspErrors the vsp errors
+ */
+ public void setVspErrors(Collection<ErrorCode> vspErrors) {
+ this.vspErrors = vspErrors;
+ if (CollectionUtils.isNotEmpty(vspErrors)) {
+ valid = false;
+ }
+ VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors);
+ }
- /**
- * Sets licensing data errors.
- *
- * @param licensingDataErrors the licensing data errors
- */
- public void setLicensingDataErrors(Collection<ErrorCode> licensingDataErrors) {
- this.licensingDataErrors = licensingDataErrors;
- if (CollectionUtils.isNotEmpty(licensingDataErrors)) {
- valid = false;
+ public Collection<ErrorCode> getLicensingDataErrors() {
+ return licensingDataErrors;
}
- }
- public Map<String, List<ErrorMessage>> getUploadDataErrors() {
- return uploadDataErrors;
- }
+ /**
+ * Sets licensing data errors.
+ *
+ * @param licensingDataErrors the licensing data errors
+ */
+ public void setLicensingDataErrors(Collection<ErrorCode> licensingDataErrors) {
+ this.licensingDataErrors = licensingDataErrors;
+ if (CollectionUtils.isNotEmpty(licensingDataErrors)) {
+ valid = false;
+ }
+ }
- /**
- * Sets upload data errors.
- * @param uploadDataErrors the upload data errors
- */
- public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors) {
- this.uploadDataErrors = uploadDataErrors;
- if (MapUtils.isNotEmpty(uploadDataErrors)) {
- valid = false;
+ public Map<String, List<ErrorMessage>> getUploadDataErrors() {
+ return uploadDataErrors;
}
- VendorSoftwareProductUtils
- .setErrorsIntoLogger(uploadDataErrors);
- }
+ /**
+ * Sets upload data errors.
+ *
+ * @param uploadDataErrors the upload data errors
+ */
+ public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors) {
+ this.uploadDataErrors = uploadDataErrors;
+ if (MapUtils.isNotEmpty(uploadDataErrors)) {
+ valid = false;
+ }
+ VendorSoftwareProductUtils.setErrorsIntoLogger(uploadDataErrors);
+ }
- public QuestionnaireValidationResult getQuestionnaireValidationResult() {
- return questionnaireValidationResult;
- }
+ public QuestionnaireValidationResult getQuestionnaireValidationResult() {
+ return questionnaireValidationResult;
+ }
- /**
- * Sets questionnaire validation result.
- *
- * @param questionnaireValidationResult the questionnaire validation result
- */
- public void setQuestionnaireValidationResult(
- QuestionnaireValidationResult questionnaireValidationResult) {
- this.questionnaireValidationResult = questionnaireValidationResult;
- if (questionnaireValidationResult != null && !questionnaireValidationResult.isValid()) {
- valid = false;
+ /**
+ * Sets questionnaire validation result.
+ *
+ * @param questionnaireValidationResult the questionnaire validation result
+ */
+ public void setQuestionnaireValidationResult(QuestionnaireValidationResult questionnaireValidationResult) {
+ this.questionnaireValidationResult = questionnaireValidationResult;
+ if (questionnaireValidationResult != null && !questionnaireValidationResult.isValid()) {
+ valid = false;
+ }
}
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java
index ad604e822e..ad6e5fb2ec 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MonitoringUploadStatus.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,49 +17,44 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator;
public class MonitoringUploadStatus {
- private String snmpTrap;
- private String snmpPoll;
- private String vesEvent;
-
-
- //todo 1802 tech debt story : refactor this to be a map of type-filename
-
-
- public MonitoringUploadStatus(String snmpTrap, String snmpPoll) {
- this.snmpTrap = snmpTrap;
- this.snmpPoll = snmpPoll;
- }
- public MonitoringUploadStatus() {
- }
+ private String snmpTrap;
+ private String snmpPoll;
+ private String vesEvent;
- public String getSnmpTrap() {
- return snmpTrap;
- }
+ //todo 1802 tech debt story : refactor this to be a map of type-filename
+ public MonitoringUploadStatus(String snmpTrap, String snmpPoll) {
+ this.snmpTrap = snmpTrap;
+ this.snmpPoll = snmpPoll;
+ }
- public void setSnmpTrap(String snmpTrap) {
- this.snmpTrap = snmpTrap;
- }
+ public MonitoringUploadStatus() {
+ }
- public String getSnmpPoll() {
- return snmpPoll;
- }
+ public String getSnmpTrap() {
+ return snmpTrap;
+ }
- public String getVesEvent() {
- return vesEvent;
- }
+ public void setSnmpTrap(String snmpTrap) {
+ this.snmpTrap = snmpTrap;
+ }
- public void setVesEvent(String vesEvent) {
- this.vesEvent = vesEvent;
- }
+ public String getSnmpPoll() {
+ return snmpPoll;
+ }
- public void setSnmpPoll(String snmpPoll) {
- this.snmpPoll = snmpPoll;
+ public void setSnmpPoll(String snmpPoll) {
+ this.snmpPoll = snmpPoll;
+ }
+ public String getVesEvent() {
+ return vesEvent;
+ }
- }
+ public void setVesEvent(String vesEvent) {
+ this.vesEvent = vesEvent;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/zusammen/ItemProperties.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/zusammen/ItemProperties.java
index 03aad04e15..0bf3037e5b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/zusammen/ItemProperties.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/zusammen/ItemProperties.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.types.zusammen;
/**
@@ -21,12 +20,12 @@ package org.openecomp.sdc.vendorsoftwareproduct.types.zusammen;
* @since February 16, 2017
*/
public class ItemProperties {
- public static final String TYPE = "type";
- public static final String CATEGORY = "category";
- public static final String VENDOR_NAME = "vendorName";
- public static final String VSP_ID = "vspId";
- private ItemProperties(){
+ public static final String TYPE = "type";
+ public static final String CATEGORY = "category";
+ public static final String VENDOR_NAME = "vendorName";
+ public static final String VSP_ID = "vspId";
- }
+ private ItemProperties() {
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java
index 39f04d67c6..8d6546f209 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ComponentDependencyTracker.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.utils;
import java.util.HashMap;
@@ -22,51 +21,48 @@ import java.util.Map;
import java.util.Set;
public class ComponentDependencyTracker {
- private final Map<String, Set<String>> store = new HashMap<>();
- /**
- * Add dependency.
- *
- * @param dependent the dependent
- * @param dependsOn the depends on
- */
- public void addDependency(String dependent, String dependsOn) {
- if (dependent != null && dependsOn != null && dependent.trim().length() > 0 && dependsOn.trim()
- .length() > 0) {
- Set<String> dependsOnList = store
- .computeIfAbsent(dependent.toLowerCase(), k -> new HashSet<>());
- dependsOnList.add(dependsOn.toLowerCase());
- }
- }
+ private final Map<String, Set<String>> store = new HashMap<>();
- /**
- * Is cyclic dependency present boolean.
- *
- * @return the boolean
- */
- public boolean isCyclicDependencyPresent() {
- Set<Map.Entry<String, Set<String>>> entries = store.entrySet();
- for (Map.Entry<String, Set<String>> entry : entries) {
- for (String dependentOn : entry.getValue()) {
- if (!entry.getKey().equals(dependentOn) && isCyclicDependencyPresent(entry.getKey(),
- dependentOn)) {
- return true;
+ /**
+ * Add dependency.
+ *
+ * @param dependent the dependent
+ * @param dependsOn the depends on
+ */
+ public void addDependency(String dependent, String dependsOn) {
+ if (dependent != null && dependsOn != null && dependent.trim().length() > 0 && dependsOn.trim().length() > 0) {
+ Set<String> dependsOnList = store.computeIfAbsent(dependent.toLowerCase(), k -> new HashSet<>());
+ dependsOnList.add(dependsOn.toLowerCase());
}
- }
}
- return false;
- }
- private boolean isCyclicDependencyPresent(String root, String dependentOn) {
- Set<String> dependentOnList = store.get(dependentOn);
- if (dependentOnList != null && dependentOnList.contains(root)) {
- return true;
- } else if (dependentOnList != null) {
- for (String item : dependentOnList) {
- return isCyclicDependencyPresent(root, item);
- }
+ /**
+ * Is cyclic dependency present boolean.
+ *
+ * @return the boolean
+ */
+ public boolean isCyclicDependencyPresent() {
+ Set<Map.Entry<String, Set<String>>> entries = store.entrySet();
+ for (Map.Entry<String, Set<String>> entry : entries) {
+ for (String dependentOn : entry.getValue()) {
+ if (!entry.getKey().equals(dependentOn) && isCyclicDependencyPresent(entry.getKey(), dependentOn)) {
+ return true;
+ }
+ }
+ }
+ return false;
}
- return false;
- }
+ private boolean isCyclicDependencyPresent(String root, String dependentOn) {
+ Set<String> dependentOnList = store.get(dependentOn);
+ if (dependentOnList != null && dependentOnList.contains(root)) {
+ return true;
+ } else if (dependentOnList != null) {
+ for (String item : dependentOnList) {
+ return isCyclicDependencyPresent(root, item);
+ }
+ }
+ return false;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
index ded0d3d2df..575c74d93c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java
@@ -13,9 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorsoftwareproduct.utils;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.enrichment.types.MonitoringUploadType;
@@ -30,96 +35,84 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
-import java.io.File;
-import java.util.*;
-
public class VendorSoftwareProductUtils {
- private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductUtils.class);
-
- private VendorSoftwareProductUtils(){
-
- }
+ private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductUtils.class);
- /**
- * Add file names to upload file response.
- *
- * @param fileContentMap the file content map
- * @param uploadFileResponse the upload file response
- */
- public static void addFileNamesToUploadFileResponse(FileContentHandler fileContentMap,
- OrchestrationTemplateActionResponse uploadFileResponse) {
- uploadFileResponse.setFileNames(new ArrayList<>());
- for (String filename : fileContentMap.getFileList()) {
- if (!new File(filename).isDirectory()) {
- uploadFileResponse.addNewFileToList(filename);
- }
+ private VendorSoftwareProductUtils() {
}
- uploadFileResponse.removeFileFromList(SdcCommon.MANIFEST_NAME);
- }
- /**
- * Validate content zip data.
- *
- * @param contentMap the content map
- * @param errors the errors
- */
- public static void validateContentZipData(FileContentHandler contentMap,
- Map<String, List<ErrorMessage>> errors) {
- if (contentMap.getFileList().isEmpty()) {
- ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
- .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
- }
- }
-
-
- /**
- * Maps all artifacts by type.
- *
- * @param artifacts the artifacts
- * @return the map
- */
- public static Map<MonitoringUploadType, String> mapArtifactsByType(
- Collection<ComponentMonitoringUploadEntity> artifacts) {
- Map<MonitoringUploadType, String> artifactTypeToFilename
- = new EnumMap<>(MonitoringUploadType.class);
- for (ComponentMonitoringUploadEntity entity : artifacts) {
- artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
+ /**
+ * Add file names to upload file response.
+ *
+ * @param fileContentMap the file content map
+ * @param uploadFileResponse the upload file response
+ */
+ public static void addFileNamesToUploadFileResponse(FileContentHandler fileContentMap, OrchestrationTemplateActionResponse uploadFileResponse) {
+ uploadFileResponse.setFileNames(new ArrayList<>());
+ for (String filename : fileContentMap.getFileList()) {
+ if (!new File(filename).isDirectory()) {
+ uploadFileResponse.addNewFileToList(filename);
+ }
+ }
+ uploadFileResponse.removeFileFromList(SdcCommon.MANIFEST_NAME);
}
- return artifactTypeToFilename;
- }
-
-
- /**
- * Sets errors into logger.
- * @param errors the errors
- */
- public static void setErrorsIntoLogger(Map<String, List<ErrorMessage>> errors) {
- if (MapUtils.isEmpty(errors)) {
- return;
+ /**
+ * Validate content zip data.
+ *
+ * @param contentMap the content map
+ * @param errors the errors
+ */
+ public static void validateContentZipData(FileContentHandler contentMap, Map<String, List<ErrorMessage>> errors) {
+ if (contentMap.getFileList().isEmpty()) {
+ ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
+ .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
+ }
}
- for (Map.Entry<String, List<ErrorMessage>> listEntry : errors.entrySet()) {
- List<ErrorMessage> errorList = listEntry.getValue();
- for (ErrorMessage message : errorList) {
- LOGGER.error(message.getMessage());
- }
+ /**
+ * Maps all artifacts by type.
+ *
+ * @param artifacts the artifacts
+ * @return the map
+ */
+ public static Map<MonitoringUploadType, String> mapArtifactsByType(Collection<ComponentMonitoringUploadEntity> artifacts) {
+ Map<MonitoringUploadType, String> artifactTypeToFilename = new EnumMap<>(MonitoringUploadType.class);
+ for (ComponentMonitoringUploadEntity entity : artifacts) {
+ artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
+ }
+ return artifactTypeToFilename;
}
- }
-
- /**
- * Sets errors into logger.
- * @param errors the errors
- */
- public static void setErrorsIntoLogger(Collection<ErrorCode> errors) {
- if (CollectionUtils.isEmpty(errors)) {
- return;
+ /**
+ * Sets errors into logger.
+ *
+ * @param errors the errors
+ */
+ public static void setErrorsIntoLogger(Map<String, List<ErrorMessage>> errors) {
+ if (MapUtils.isEmpty(errors)) {
+ return;
+ }
+ for (Map.Entry<String, List<ErrorMessage>> listEntry : errors.entrySet()) {
+ List<ErrorMessage> errorList = listEntry.getValue();
+ for (ErrorMessage message : errorList) {
+ LOGGER.error(message.getMessage());
+ }
+ }
}
- for (ErrorCode error : errors) {
- LOGGER.error(error.message());
+ /**
+ * Sets errors into logger.
+ *
+ * @param errors the errors
+ */
+ public static void setErrorsIntoLogger(Collection<ErrorCode> errors) {
+ if (CollectionUtils.isEmpty(errors)) {
+ return;
+ }
+ for (ErrorCode error : errors) {
+ LOGGER.error(error.message());
+ }
}
- }
}