summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentDependencyModelManager.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java23
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java20
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ImageManager.java20
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ManualVspToscaManager.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/MonitoringUploadsManager.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessManager.java23
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java44
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentDependencyModelErrorBuilder.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java31
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java24
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerFactoryImpl.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java119
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java79
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerFactoryImpl.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java390
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java123
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java211
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java21
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerFactoryImpl.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java37
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java20
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java79
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java172
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerFactoryImpl.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java201
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java747
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java16
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java149
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java228
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java70
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java271
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java1
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java16
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java73
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java82
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/FileDataStructureDto.java69
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/GetFileDataStructureResponseDTO.java69
53 files changed, 1349 insertions, 2284 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 a651b0bb12..869628e6f5 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
@@ -4,12 +4,17 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModel
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
-import java.util.List;
public interface ComponentDependencyModelManager {
- void createComponentDependencyModel(List<ComponentDependencyModelEntity> entities, String
- vspId, Version version, String user);
+ Collection<ComponentDependencyModelEntity> list(String vspId, Version version);
- Collection<ComponentDependencyModelEntity> list(String vspId, Version version, String user);
+ ComponentDependencyModelEntity createComponentDependency(ComponentDependencyModelEntity entity,
+ String vspId, Version version);
+
+ void delete(String vspId, Version version, String dependencyId);
+
+ void update(ComponentDependencyModelEntity entity);
+
+ 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/ComponentManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentManager.java
index b895f5595f..413529882d 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
@@ -31,24 +31,23 @@ import java.util.Collection;
public interface ComponentManager {
- Collection<ComponentEntity> listComponents(String vspId, Version version, String user);
+ Collection<ComponentEntity> listComponents(String vspId, Version version);
- void deleteComponents(String vspId, Version version, String user);
+ void deleteComponents(String vspId, Version version);
- ComponentEntity createComponent(ComponentEntity componentEntity, String user);
+ ComponentEntity createComponent(ComponentEntity componentEntity);
- CompositionEntityValidationData updateComponent(ComponentEntity componentEntity, String user);
+ CompositionEntityValidationData updateComponent(ComponentEntity componentEntity);
CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version,
- String componentId, String user);
+ String componentId);
- void deleteComponent(String vspId, Version version, String componentId, String user);
+ void deleteComponent(String vspId, Version version, String componentId);
- QuestionnaireResponse getQuestionnaire(String vspId, Version version, String componentId,
- String user);
+ QuestionnaireResponse getQuestionnaire(String vspId, Version version, String componentId);
void updateQuestionnaire(String vspId, Version version, String componentId,
- String questionnaireData, String user);
+ String questionnaireData);
- void validateComponentExistence(String vspId, Version version, String componentId, String user);
+ 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/ComputeManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeManager.java
index 65bceb9864..7ddd4e20c8 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
@@ -12,23 +12,20 @@ import java.util.Collection;
public interface ComputeManager {
- Collection<ListComputeResponse> listCompute(String vspId, Version version, String
- componentId, String user);
+ Collection<ListComputeResponse> listComputes(String vspId, Version version, String componentId);
- ComputeEntity createCompute(ComputeEntity compute, String user);
+ ComputeEntity createCompute(ComputeEntity compute);
- CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version, String
- componentId, String computeFlavorId, String user);
+ CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version,
+ String componentId, String computeFlavorId);
- QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String
- componentId, String computeFlavorId, String user);
+ QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String componentId,
+ String computeFlavorId);
- void updateComputeQuestionnaire(String vspId, Version version, String componentId, String
- computeId, String
- questionnaireData, String user);
+ void updateComputeQuestionnaire(String vspId, Version version, String componentId,
+ String computeId, String questionnaireData);
- CompositionEntityValidationData updateCompute(ComputeEntity compute, String user);
+ CompositionEntityValidationData updateCompute(ComputeEntity compute);
- void deleteCompute(String vspId, Version version,String componentId, String computeFlavorId,
- String user);
+ 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/DeploymentFlavorManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorManager.java
index 51ba2f4d40..88d399aa5c 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
@@ -12,23 +12,19 @@ import java.util.Collection;
public interface DeploymentFlavorManager {
- DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity,
- String user);
+ DeploymentFlavorEntity createDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity);
- Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version,
- String user);
+ Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version);
CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId, Version version,
- String deploymentFlavorId,
- String user);
+ String deploymentFlavorId);
- CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId, Version
- version, String user);
+ CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId,
+ Version version);
- void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId, String
- user);
+ void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId);
- CompositionEntityValidationData updateDeploymentFlavor(DeploymentFlavorEntity
- deploymentFlavorEntity, String user);
+ CompositionEntityValidationData updateDeploymentFlavor(
+ DeploymentFlavorEntity deploymentFlavorEntity);
}
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 6bbfc0b69a..1a53221951 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
@@ -10,24 +10,22 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
public interface ImageManager {
- ImageEntity createImage(ImageEntity imageEntity, String user);
+ ImageEntity createImage(ImageEntity imageEntity);
- CompositionEntityResponse<Image> getImageSchema(String vspId, String user);
+ CompositionEntityResponse<Image> getImageSchema(String vspId);
- Collection<ImageEntity> listImages(String vspId, Version version, String componentId,
- String user);
+ Collection<ImageEntity> listImages(String vspId, Version version, String componentId);
CompositionEntityResponse<Image> getImage(String vspId, Version version, String componentId,
- String imageId, String user);
+ String imageId);
- QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String
- componentId, String imageId, String user);
+ QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String componentId,
+ String imageId);
- void deleteImage(String vspId, Version version, String componentId, String imageId, String user);
+ void deleteImage(String vspId, Version version, String componentId, String imageId);
- CompositionEntityValidationData updateImage(ImageEntity imageEntity, String user);
+ CompositionEntityValidationData updateImage(ImageEntity imageEntity);
void updateImageQuestionnaire(String vspId, Version version, String componentId, String imageId,
- String
- questionnaireData, String user);
+ String questionnaireData);
}
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 c9a5206383..621374ad3c 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
@@ -6,7 +6,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
public interface ManualVspToscaManager {
- public VspModelInfo gatherVspInformation(String vspId, Version version, String user);
+ VspModelInfo gatherVspInformation(String vspId, Version version);
- public 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 f5e34a01be..36f06507dc 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
@@ -28,11 +28,10 @@ import java.io.InputStream;
public interface MonitoringUploadsManager {
void delete(String vspId, Version version, String componentId,
- MonitoringUploadType monitoringUploadType, String user);
+ MonitoringUploadType monitoringUploadType);
void upload(InputStream object, String filename, String vspId, Version version,
- String componentId, MonitoringUploadType monitoringUploadType, String user);
+ String componentId, MonitoringUploadType monitoringUploadType);
- MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId,
- String user);
+ 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/NetworkManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NetworkManager.java
index b647735188..fa740690b7 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
@@ -29,14 +29,13 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
public interface NetworkManager {
- Collection<NetworkEntity> listNetworks(String vspId, Version version, String user);
+ Collection<NetworkEntity> listNetworks(String vspId, Version version);
- NetworkEntity createNetwork(NetworkEntity network, String user);
+ NetworkEntity createNetwork(NetworkEntity network);
- CompositionEntityValidationData updateNetwork(NetworkEntity networkEntity, String user);
+ CompositionEntityValidationData updateNetwork(NetworkEntity networkEntity);
- CompositionEntityResponse<Network> getNetwork(String vspId, Version version, String networkId,
- String user);
+ CompositionEntityResponse<Network> getNetwork(String vspId, Version version, String networkId);
- void deleteNetwork(String vspId, Version version, String networkId, String user);
+ 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/NicManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/NicManager.java
index 466583edfd..b055d97ef3 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
@@ -31,20 +31,20 @@ import java.util.Collection;
public interface NicManager {
- Collection<NicEntity> listNics(String vspId, Version version, String componentId, String user);
+ Collection<NicEntity> listNics(String vspId, Version version, String componentId);
- NicEntity createNic(NicEntity nic, String user);
+ NicEntity createNic(NicEntity nic);
- CompositionEntityValidationData updateNic(NicEntity nicEntity, String user);
+ CompositionEntityValidationData updateNic(NicEntity nicEntity);
CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId,
- String nicId, String user);
+ String nicId);
- void deleteNic(String vspId, Version version, String componentId, String nicId, String user);
+ void deleteNic(String vspId, Version version, String componentId, String nicId);
QuestionnaireResponse getNicQuestionnaire(String vspId, Version version, String componentId,
- String nicId, String user);
+ String nicId);
void updateNicQuestionnaire(String vspId, Version version, String componentId, String nicId,
- String questionnaireData, String user);
+ String questionnaireData);
}
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 e2ef86149b..84318dbdd8 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
@@ -21,6 +21,7 @@
package org.openecomp.sdc.vendorsoftwareproduct;
import org.apache.commons.lang3.tuple.Pair;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
@@ -33,14 +34,16 @@ import java.util.Optional;
public interface OrchestrationTemplateCandidateManager {
UploadFileResponse upload(String vspId, Version version, InputStream heatFileToUpload,
- String user, String filePrefix, String networkPackageName);
+ String fileSuffix, String networkPackageName);
- OrchestrationTemplateActionResponse process(String vspId, Version version, String user);
+ OrchestrationTemplateActionResponse process(String vspId, Version version);
- Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version, String user);
+ Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version);
- ValidationResponse updateFilesDataStructure(String vspId, Version version, String user,
+ ValidationResponse updateFilesDataStructure(String vspId, Version version,
FilesDataStructure fileDataStructure);
- Optional<Pair<String, byte[]>> get(String vspId, Version version, String user) throws IOException;
+ Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException;
+
+ OrchestrationTemplateCandidateData getInfo(String vspId, Version version);
}
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 afe88d2053..979eea0fb8 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
@@ -28,27 +28,22 @@ import java.io.InputStream;
import java.util.Collection;
public interface ProcessManager {
- Collection<ProcessEntity> listProcesses(String vspId, Version version, String componentId,
- String user);
+ Collection<ProcessEntity> listProcesses(String vspId, Version version, String componentId);
- void deleteProcesses(String vspId, Version version, String componentId, String user);
+ void deleteProcesses(String vspId, Version version, String componentId);
- ProcessEntity createProcess(ProcessEntity processEntity, String user);
+ ProcessEntity createProcess(ProcessEntity processEntity);
- ProcessEntity getProcess(String vspId, Version version, String componentId, String processId,
- String user);
+ ProcessEntity getProcess(String vspId, Version version, String componentId, String processId);
- void updateProcess(ProcessEntity processEntity, String user);
+ void updateProcess(ProcessEntity processEntity);
- void deleteProcess(String vspId, Version version, String componentId, String processId,
- String user);
+ void deleteProcess(String vspId, Version version, String componentId, String processId);
- File getProcessArtifact(String vspId, Version version, String componentId, String processId,
- String user);
+ File getProcessArtifact(String vspId, Version version, String componentId, String processId);
- void deleteProcessArtifact(String vspId, Version version, String componentId, String processId,
- String user);
+ void deleteProcessArtifact(String vspId, Version version, String componentId, String processId);
void uploadProcessArtifact(InputStream uploadFile, String fileName, String vspId,
- Version version, String componentId, String processId, String user);
+ 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/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
index 0adca1c695..2e38122856 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
@@ -20,65 +20,55 @@
package org.openecomp.sdc.vendorsoftwareproduct;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionInfo;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
public interface VendorSoftwareProductManager {
- Version checkout(String vendorSoftwareProductId, String user);
+ VspDetails createVsp(VspDetails vspDetails);
- Version undoCheckout(String vendorSoftwareProductId, String user);
+ void updateVsp(VspDetails vspDetails);
- Version checkin(String vendorSoftwareProductId, String user);
+ VspDetails getVsp(String vspId, Version version);
- ValidationResponse submit(String vendorSoftwareProductId, String user) throws IOException;
+ void deleteVsp(String vspIdToDelete);
+ ValidationResponse validate(String vspId, Version version) throws IOException;
- List<VersionedVendorSoftwareProductInfo> listVsps(String versionFilter, String user);
+ Map<String, List<ErrorMessage>> compile(String vspId, Version version);
- VspDetails createVsp(VspDetails vspDetails, String user);
- void updateVsp(VspDetails vspDetails, String user);
+ QuestionnaireResponse getVspQuestionnaire(String vspId, Version version);
- VspDetails getVsp(String vspId, Version version, String user);
+ void updateVspQuestionnaire(String vspId, Version version, String questionnaireData);
- Version callAutoHeal(String vspId, VersionInfo versionInfo,
- VspDetails vendorSoftwareProductInfo, String user) throws Exception;
- void deleteVsp(String vspIdToDelete, String user);
+ byte[] getOrchestrationTemplateFile(String vspId, Version version);
- QuestionnaireResponse getVspQuestionnaire(String vspId, Version version, String user);
+ OrchestrationTemplateEntity getOrchestrationTemplateInfo(String vspId, Version version);
- void updateVspQuestionnaire(String vspId, Version version, String questionnaireData, String user);
-
- byte[] getOrchestrationTemplateFile(String vspId, Version version, String user);
-
- PackageInfo createPackage(String vspId, Version version, String user) throws IOException;
+ PackageInfo createPackage(String vspId, Version version) throws IOException;
List<PackageInfo> listPackages(String category, String subCategory);
- File getTranslatedFile(String vspId, Version version, String user);
-
- void heal(String vspId, Version version, String user);
- File getInformationArtifact(String vspId, Version version, String user);
+ File getTranslatedFile(String vspId, Version version);
- String fetchValidationVsp(String user);
+ File getInformationArtifact(String vspId, Version version);
- Collection<ComputeEntity> getComputeByVsp(String vspId, Version version, String user);
- Version healAndAdvanceFinalVersion(String vspId, VspDetails vendorSoftwareProductInfo,
- String user) throws IOException;
+ Collection<ComputeEntity> getComputeByVsp(String vspId, Version version);
}
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 78605c86fc..53ad74b772 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
@@ -1,18 +1,14 @@
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.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;
+
public class ComponentDependencyModelErrorBuilder {
private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
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 b242b7169c..5d58f5c35b 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
@@ -2,41 +2,16 @@ 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;
public class DuplicateComputeInComponentErrorBuilder {
-
- private static final String DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG =
- "Invalid request, Compute with name %s already exists for component with ID %s.";
- private static final String COMPUTE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed "
- + "for VSP onboarded via HEAT.";
- private static final String COMPUTE_MANUAL_READONLY_ATTR_MSG = "Update of attribute %s not allowed "
- + "for VSP onboarded manually.";
-
+ 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 DuplicateComputeInComponentErrorBuilder(String computeName, String componentId ){
- builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG,computeName,
- componentId));
- }
-
- /**
- * Gets duplicate compute name error builder.
- *
- * @return the duplicate compute name error builder
- */
- public static ErrorCode getDuplicateComputeNameErrorBuilder(String computeName, String componenetId) {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG, computeName, componenetId ));
- return builder.build();
- }
-
public static ErrorCode getComputeHeatReadOnlyErrorBuilder(String name) {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
builder.withId(UPDATE_COMPUTE_NOT_ALLOWED);
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 9ac6e1b1bb..2d22d01774 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
@@ -3,7 +3,11 @@ 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.*;
+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;
/**
* The Image error builder.
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 5fc29d5a4f..eed56e1a1a 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
@@ -28,8 +28,7 @@ import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProdu
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";
+ "Monitoring file uploaded for vendor software product with Id %s and version %s is invalid: %s";
/**
@@ -44,7 +43,7 @@ public class MonitoringUploadErrorBuilder extends BaseErrorBuilder {
getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID);
getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
getErrorCodeBuilder().withMessage(String.format(UPLOAD_INVALID_DETAILED_MSG,
- vendorSoftwareProductId, version == null ? null : version.toString(), error));
+ vendorSoftwareProductId, version == null ? null : version.getId(), error));
}
/**
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 0850d2e704..2acfde48ff 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
@@ -1,11 +1,11 @@
package org.openecomp.sdc.vendorsoftwareproduct.errors;
-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;
-
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.";
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 7801df8fd7..1b6896211b 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
@@ -1,5 +1,8 @@
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.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;
@@ -7,9 +10,6 @@ import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProdu
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;
-
public class NotSupportedHeatOnboardMethodErrorBuilder {
private static final String ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
"NIC cannot be added for VSPs onboarded with HEAT.";
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 8aad900102..49785a38f8 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
@@ -1,37 +1,19 @@
package org.openecomp.sdc.vendorsoftwareproduct.errors;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
- .VSP_INVALID_ONBOARDING_METHOD;
-import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
- .VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED;
-
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_ONBOARD_METHOD_UPDATE_NOT_ALLOWED_MSG =
- "onboardingMethod update is not allowed.";
private static final String VSP_INVALID_ONBOARDING_METHOD_MSG =
"The onboardingMethod value doesn't meet the expected attribute value.";
/**
- * Gets onboarding update error.
- *
- * @return the onboarding update error
- */
- public static ErrorCode getOnboardingUpdateError() {
- ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- builder.withId(VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED_MSG));
- return builder.build();
- }
-
- /**
* Get invalid onboarding method error builder error code.
*
* @return the error code
@@ -40,7 +22,7 @@ public class OnboardingMethodErrorBuilder {
ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
builder.withId(VSP_INVALID_ONBOARDING_METHOD);
builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VSP_INVALID_ONBOARDING_METHOD_MSG));
+ 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/TranslationFileCreationErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java
index 1ec3af397f..fd8acd1497 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
@@ -20,12 +20,12 @@
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 "
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 4a84c83338..4fc0b6e6f7 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
@@ -28,7 +28,7 @@ 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 " +
+ 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 final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
@@ -39,13 +39,13 @@ public class VendorSoftwareProductInvalidErrorBuilder {
* @param version the version
*/
public static ErrorCode VendorSoftwareProductMissingServiceModelErrorBuilder(String
- vendorSoftwareProductId,
- Version version) {
+ 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.toString()));
+ .withMessage(String.format(VSP_INVALID_MSG, vendorSoftwareProductId, version.getId()));
return builder.build();
}
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 b4513dec79..1f9a35cb2c 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
@@ -3,13 +3,16 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
public class ComponentDependencyModelManagerFactoryImpl extends
ComponentDependencyModelManagerFactory {
+
private static final ComponentDependencyModelManager INSTANCE =
- new ComponentDependencyModelManagerImpl(VendorSoftwareProductDaoFactory.getInstance()
- .createInterface(), ComponentManagerFactory.getInstance().createInterface());
+ new ComponentDependencyModelManagerImpl(
+ ComponentManagerFactory.getInstance().createInterface(),
+ ComponentDependencyModelDaoFactory.getInstance().createInterface()
+ );
@Override
public ComponentDependencyModelManager createInterface() {
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 5dc1446601..17d1833af6 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
@@ -1,6 +1,7 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.lang3.StringUtils;
+import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
@@ -12,72 +13,114 @@ import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder;
+import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
-import java.util.List;
public class ComponentDependencyModelManagerImpl implements ComponentDependencyModelManager {
- private VendorSoftwareProductDao vendorSoftwareProductDao;
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
protected static final Logger logger =
LoggerFactory.getLogger(ComponentDependencyModelManagerImpl.class);
private ComponentManager componentManager;
+ private ComponentDependencyModelDao componentDependencyModelDao;
- public ComponentDependencyModelManagerImpl(VendorSoftwareProductDao vendorSoftwareProductDao, ComponentManager componentManager) {
- this.vendorSoftwareProductDao = vendorSoftwareProductDao;
+ public ComponentDependencyModelManagerImpl(
+ ComponentManager componentManager, ComponentDependencyModelDao componentDependencyModelDao) {
this.componentManager = componentManager;
+ this.componentDependencyModelDao = componentDependencyModelDao;
+ }
+
+ private void raiseException(ErrorCode errorCode) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+ LoggerTragetServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL, ErrorLevel.ERROR.name(),
+ errorCode.id(), errorCode.message());
+ throw new CoreException(errorCode);
}
@Override
- public void createComponentDependencyModel(List<ComponentDependencyModelEntity> entities,
- String vspId, Version version, String user) {
-
- mdcDataDebugMessage.debugEntryMessage("createComponentDependencyModel");
- for(ComponentDependencyModelEntity entity : entities) {
- if (!StringUtils.isEmpty(entity.getSourceComponentId())) {
- componentManager.validateComponentExistence(entity.getVspId(), entity.getVersion(),
- entity.getSourceComponentId(), user);
- if (entity.getSourceComponentId().equals(entity.getTargetComponentId())) {
- ErrorCode errorCode =
- ComponentDependencyModelErrorBuilder.getSourceTargetComponentEqualErrorBuilder();
- raiseException(errorCode);
- }
- } else {
- ErrorCode errorCode = ComponentDependencyModelErrorBuilder
- .getNoSourceComponentErrorBuilder();
- raiseException(errorCode);
- }
+ public Collection<ComponentDependencyModelEntity> list(String vspId, Version version) {
+
+ mdcDataDebugMessage.debugExitMessage("VSP id, version", vspId, version.toString());
+
+ return componentDependencyModelDao
+ .list(new ComponentDependencyModelEntity(vspId, version, null));
+ }
+
+ @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(), user);
+ 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();
+ raiseException(errorCode);
}
+ } else {
+ ErrorCode errorCode = ComponentDependencyModelErrorBuilder
+ .getNoSourceComponentErrorBuilder();
+ raiseException(errorCode);
}
- vendorSoftwareProductDao.createComponentDependencyModel(entities, vspId, version );
-
- mdcDataDebugMessage.debugExitMessage("createComponentDependencyModel");
+ if (!StringUtils.isEmpty(entity.getTargetComponentId())) {
+ componentManager.validateComponentExistence(entity.getVspId(), entity.getVersion(),
+ entity.getTargetComponentId());
+ }
}
- private void raiseException(ErrorCode errorCode) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message());
- throw new CoreException(errorCode);
+ @Override
+ public void delete(String vspId, Version version, String dependencyId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, dependencyId", vspId, dependencyId);
+ ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(vspId,
+ version, dependencyId);
+ if (componentDependencyEntity != null) {
+ componentDependencyModelDao.delete(componentDependencyEntity);
+ }
+
+ mdcDataDebugMessage.debugExitMessage("VSP id, dependencyId", vspId, dependencyId);
}
@Override
- public Collection<ComponentDependencyModelEntity> list(String vspId, Version version, String
- user) {
+ public void update(ComponentDependencyModelEntity entity) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, dependencyId", entity.getVspId(),
+ entity.getId());
+ ComponentDependencyModelEntity componentDependencyEntity = getComponentDependency(
+ entity.getVspId(), entity.getVersion(), entity.getId());
+ validateComponentDependency(entity);
+ componentDependencyModelDao.update(entity);
+ }
- mdcDataDebugMessage.debugExitMessage("VSP id, version", vspId, version.toString());
+ @Override
+ public ComponentDependencyModelEntity get(String vspId, Version version, String dependencyId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, dependencyId", vspId, dependencyId);
+ ComponentDependencyModelEntity componentDependency =
+ getComponentDependency(vspId, version, dependencyId);
+ return componentDependency;
+ }
- return vendorSoftwareProductDao.listComponentDependencies(vspId, version);
+ 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/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
index 72a38bbb5d..1834bf05d6 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
@@ -67,10 +67,10 @@ public class ComponentManagerImpl implements ComponentManager {
private NicManager nicManager;
private VendorSoftwareProductInfoDao vspInfoDao;
- public ComponentManagerImpl(
- ComponentDao componentDao,
- CompositionEntityDataManager compositionEntityDataManager,
- NicManager nicManager, VendorSoftwareProductInfoDao vspInfoDao) {
+ public ComponentManagerImpl(ComponentDao componentDao,
+ CompositionEntityDataManager compositionEntityDataManager,
+ NicManager nicManager,
+ VendorSoftwareProductInfoDao vspInfoDao) {
this.componentDao = componentDao;
this.compositionEntityDataManager = compositionEntityDataManager;
this.nicManager = nicManager;
@@ -78,14 +78,14 @@ public class ComponentManagerImpl implements ComponentManager {
}
@Override
- public Collection<ComponentEntity> listComponents(String vspId, Version version, String user) {
+ public Collection<ComponentEntity> listComponents(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return componentDao.list(new ComponentEntity(vspId, version, null));
}
@Override
- public void deleteComponents(String vspId, Version version, String user) {
+ public void deleteComponents(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
if (!vspInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -95,12 +95,11 @@ public class ComponentManagerImpl implements ComponentManager {
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
- //componentDao.updateVspLatestModificationTime(vspId, version);
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
}
/*@Override
- public ComponentEntity createComponent(ComponentEntity component, String user) {
+ public ComponentEntity createComponent(ComponentEntity component) {
mdcDataDebugMessage.debugEntryMessage("VSP id", component.getId());
if (!isManual(component.getVspId(), component.getVersion())) {
@@ -112,24 +111,18 @@ public class ComponentManagerImpl implements ComponentManager {
.build());
}
- //componentDao.updateVspLatestModificationTime(component.getVspId(), component.getVersion());
mdcDataDebugMessage.debugExitMessage("VSP id", component.getId());
return null;
}*/
@Override
- public ComponentEntity createComponent(ComponentEntity component, String user) {
+ public ComponentEntity createComponent(ComponentEntity component) {
mdcDataDebugMessage.debugEntryMessage("VSP id", component.getId());
- /*Version activeVersion =
- getVersionInfo(component.getVspId(), VersionableEntityAction.Write, user)
- .getActiveVersion();
- component.setVersion(activeVersion);*/
final String VFC_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
"VFCs cannot be added for VSPs onboarded with HEAT.";
- ComponentEntity createdComponent = null;
-
+ ComponentEntity createdComponent;
if (!vspInfoDao.isManual(component.getVspId(), component.getVersion())) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(),
@@ -141,7 +134,7 @@ public class ComponentManagerImpl implements ComponentManager {
} else {
validateComponentManual(component);
updateComponentName(component);
- createdComponent = createComponent(component);
+ createdComponent = compositionEntityDataManager.createComponent(component);
}
mdcDataDebugMessage.debugExitMessage("VSP id", component.getId());
@@ -149,10 +142,6 @@ public class ComponentManagerImpl implements ComponentManager {
return createdComponent;
}
- private ComponentEntity createComponent(ComponentEntity component) {
- return compositionEntityDataManager.createComponent(component);
- }
-
private void updateComponentName(ComponentEntity component) {
ComponentData data = component.getComponentCompositionData();
data.setName(COMPUTE_TYPE_PREFIX + data.getDisplayName());
@@ -166,8 +155,8 @@ public class ComponentManagerImpl implements ComponentManager {
final String VSP_VFC_DUPLICATE_NAME_MSG = "VFC with specified name "
+ "already present in given VSP.";
- Collection<ComponentEntity> vspComponentList = listComponents(component.getVspId()
- , component.getVersion(), null);
+ Collection<ComponentEntity> vspComponentList =
+ listComponents(component.getVspId(), component.getVersion());
if (vspComponentList.size() >= 1) //1707 release only supports 1 VFC in VSP (manual creation)
{
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -202,18 +191,17 @@ public class ComponentManagerImpl implements ComponentManager {
}
@Override
- public CompositionEntityValidationData updateComponent(ComponentEntity component, String user) {
+ public CompositionEntityValidationData updateComponent(ComponentEntity component) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", component
.getVspId(), component.getId());
ComponentEntity retrieved =
- getComponent(component.getVspId(), component.getVersion(), component.getId());
+ getValidatedComponent(component.getVspId(), component.getVersion(), component.getId());
boolean isManual = vspInfoDao.isManual(component.getVspId(), component.getVersion());
if (isManual) {
- validateComponentUpdateManual(component, retrieved, user);
+ validateComponentUpdateManual(retrieved);
}
-
ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
schemaInput.setManual(isManual);
schemaInput.setComponent(retrieved.getComponentCompositionData());
@@ -232,19 +220,18 @@ public class ComponentManagerImpl implements ComponentManager {
return validationData;
}
- private void validateComponentUpdateManual(ComponentEntity component, ComponentEntity
- retrieved, String user) {
+ private void validateComponentUpdateManual(ComponentEntity component) {
Collection<ComponentEntity> vspComponentList =
- listComponents(component.getVspId(), component.getVersion(), user);
+ 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) {
+ for (ComponentEntity ce : vspComponentList) {
if (ce.getId().equals(component.getId())) {
vspComponentList.remove(ce);
break;
}
}
- if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData()
+ if (!isVfcNameUnique(vspComponentList, component.getComponentCompositionData()
.getDisplayName())) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.UPDATE_COMPONENT, ErrorLevel.ERROR.name(),
@@ -259,9 +246,9 @@ public class ComponentManagerImpl implements ComponentManager {
}
public CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version,
- String componentId, String user) {
+ String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- ComponentEntity componentEntity = getComponent(vspId, version, componentId);
+ ComponentEntity componentEntity = getValidatedComponent(vspId, version, componentId);
ComponentData component = componentEntity.getComponentCompositionData();
ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput();
@@ -278,7 +265,7 @@ public class ComponentManagerImpl implements ComponentManager {
}
@Override
- public void deleteComponent(String vspId, Version version, String componentId, String user) {
+ public void deleteComponent(String vspId, Version version, String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
if (!vspInfoDao.isManual(vspId, version)) {
@@ -289,14 +276,12 @@ public class ComponentManagerImpl implements ComponentManager {
new CompositionEditNotAllowedErrorBuilder(vspId, version).build());
}
- //componentDao.updateVspLatestModificationTime(vspId, version);
-
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
}
@Override
public QuestionnaireResponse getQuestionnaire(String vspId, Version version,
- String componentId, String user) {
+ String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
@@ -306,7 +291,7 @@ public class ComponentManagerImpl implements ComponentManager {
VspDetails.ENTITY_TYPE);
questionnaireResponse.setData(component.getQuestionnaireData());
- List<String> nicNames = nicManager.listNics(vspId, version, componentId, user).stream()
+ 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
@@ -319,23 +304,21 @@ public class ComponentManagerImpl implements ComponentManager {
@Override
public void updateQuestionnaire(String vspId, Version version, String componentId,
- String questionnaireData, String user) {
+ String questionnaireData) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- validateComponentExistence(vspId, version, componentId, user);
+ validateComponentExistence(vspId, version, componentId);
componentDao.updateQuestionnaireData(vspId, version, componentId, questionnaireData);
- //componentDao.updateVspLatestModificationTime(vspId, version);
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
}
@Override
- public void validateComponentExistence(String vspId, Version version, String componentId,
- String user) {
- getComponent(vspId, version, componentId);
+ public void validateComponentExistence(String vspId, Version version, String componentId) {
+ getValidatedComponent(vspId, version, componentId);
}
- private ComponentEntity getComponent(String vspId, Version version, String 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),
@@ -353,8 +336,4 @@ public class ComponentManagerImpl implements ComponentManager {
.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component,
schemaInput);
}
-
- /*private boolean isManual(String vspId, Version version) {
- return false;
- }*/
}
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 71985fa83e..598c45f323 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
@@ -2,7 +2,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
import org.openecomp.sdc.vendorsoftwareproduct.ComputeManagerFactory;
-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.VendorSoftwareProductInfoDaoFactory;
@@ -15,10 +14,7 @@ public class ComputeManagerFactoryImpl extends ComputeManagerFactory {
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
ComputeDaoFactory.getInstance().createInterface(),
CompositionEntityDataManagerFactory.getInstance().createInterface(),
- DeploymentFlavorDaoFactory.getInstance().createInterface(),
- ComponentDaoFactory.getInstance().createInterface()
-
- );
+ DeploymentFlavorDaoFactory.getInstance().createInterface());
@Override
public ComputeManager createInterface() {
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 be90b08af9..0fc0aaffb1 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
@@ -2,6 +2,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.core.util.UniqueValueUtil;
+import org.openecomp.core.utilities.json.JsonSchemaDataGenerator;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -12,7 +14,7 @@ import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -51,33 +53,22 @@ public class ComputeManagerImpl implements ComputeManager {
private CompositionEntityDataManager compositionEntityDataManager;
private VendorSoftwareProductInfoDao vspInfoDao;
private DeploymentFlavorDao deploymentFlavorDao;
- private ComponentDao componentDao;
- private static final String MANUAL = "Manual";
-
- public ComputeManagerImpl(
- VendorSoftwareProductInfoDao vspInfoDao,
- ComputeDao computeDao,
- CompositionEntityDataManager compositionEntityDataManager,
- DeploymentFlavorDao deploymentFlavorDao,
- ComponentDao componentDao
- ) {
+
+ public ComputeManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
+ ComputeDao computeDao,
+ CompositionEntityDataManager compositionEntityDataManager,
+ DeploymentFlavorDao deploymentFlavorDao) {
this.computeDao = computeDao;
this.compositionEntityDataManager = compositionEntityDataManager;
this.vspInfoDao = vspInfoDao;
this.deploymentFlavorDao = deploymentFlavorDao;
- this.componentDao = componentDao;
}
@Override
- public ComputeEntity createCompute(ComputeEntity compute, String user) {
- ComputeEntity createdCompute = null;
- mdcDataDebugMessage.debugEntryMessage("VSP id, component id", compute.getVspId(),
- compute.getComponentId());
-
- /*Version activeVersion =
- getVersionInfo(compute.getVspId(), VersionableEntityAction.Write, user).getActiveVersion();
- compute.setVersion(activeVersion);*/
- //if (!isManual(compute.getVspId(), activeVersion)) {
+ public ComputeEntity createCompute(ComputeEntity compute) {
+ mdcDataDebugMessage
+ .debugEntryMessage("VSP id, component id", compute.getVspId(), compute.getComponentId());
+
if (!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
.getAddComputeNotSupportedHeatOnboardMethodErrorBuilder();
@@ -87,92 +78,45 @@ public class ComputeManagerImpl implements ComputeManager {
onboardingMethodUpdateErrorCode.message());
throw new CoreException(onboardingMethodUpdateErrorCode);
} else {
-
- //validateComponentId(compute.getVspId(),compute.getVersion(),compute.getComponentId());
- Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion
- (),compute.getComponentId());
-
- validateVfcCompute(compute, vfcComputeList, LoggerTragetServiceName.CREATE_COMPUTE);
- createdCompute = createCompute(compute);
+ 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());
}
mdcDataDebugMessage
.debugExitMessage("VSP id, component id", compute.getVspId(), compute.getComponentId());
- return createdCompute;
+ return compute;
}
- private ComputeEntity createCompute(ComputeEntity compute) {
-
- return compositionEntityDataManager.createCompute(compute);
- }
-
- /*private void validateCompute(ComputeEntity compute) {
- Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion
- (),compute.getComponentId());
-
- if (!isComputeNameUnique(vfcComputeList,compute.getComputeCompositionData().getName())) {
- final ErrorCode duplicateComputeInComponentErrorBuilder =
- new DuplicateComputeInComponentErrorBuilder(compute.getComputeCompositionData().getName(),
- compute.getComponentId()).build();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_COMPUTE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(),
- duplicateComputeInComponentErrorBuilder.message());
- throw new CoreException(duplicateComputeInComponentErrorBuilder);
- }
-
- }*/
-
- private void validateComputeUpdate(ComputeEntity compute) {
- Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion
- (),compute.getComponentId());
-
- for (ComputeEntity ce : vfcComputeList) {
- if (ce.getId().equals(compute.getId())) {
- vfcComputeList.remove(ce);
- break;
- }
- }
-
- if (!isComputeNameUnique(vfcComputeList,compute.getComputeCompositionData().getName())) {
- final ErrorCode duplicateComputeInComponentErrorBuilder =
- new DuplicateComputeInComponentErrorBuilder(compute.getComputeCompositionData().getName(),
- compute.getComponentId()).build();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_COMPUTE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(),
- duplicateComputeInComponentErrorBuilder.message());
- throw new CoreException(duplicateComputeInComponentErrorBuilder);
- }
-
- }
@Override
- public Collection<ListComputeResponse> listCompute(String vspId, Version version,
- String componentId, String user) {
-
+ public Collection<ListComputeResponse> listComputes(String vspId, Version version,
+ String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- //validateComponentId(vspId, version, componentId);
- ComputeEntity entity = new ComputeEntity(vspId, version, componentId, null);
- Collection<ComputeEntity> computes = computeDao.list(entity);
+ Collection<ComputeEntity> computes =
+ computeDao.list(new ComputeEntity(vspId, version, componentId, null));
Collection<ListComputeResponse> computeResponse =
- getListComputeResponse(vspId, version, user, computes);
+ getListComputeResponse(vspId, version, computes);
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
return computeResponse;
}
private Collection<ListComputeResponse> getListComputeResponse(String vspId, Version version,
- String user,
Collection<ComputeEntity> computes) {
- Set<String> vspComputes = getComputeAssociatedWithDepFlavors(vspId, version, user);
- Collection<ListComputeResponse> computeResponse = new ArrayList<ListComputeResponse>();
- for(ComputeEntity 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())) {
+ if (vspComputes.contains(computeEntity.getId())) {
response.setAssociatedWithDeploymentFlavor(true);
} else {
response.setAssociatedWithDeploymentFlavor(false);
@@ -182,16 +126,15 @@ public class ComputeManagerImpl implements ComputeManager {
return computeResponse;
}
- private Set<String> getComputeAssociatedWithDepFlavors(String vspId, Version version,
- String user) {
+ private Set<String> getComputeAssociatedWithDepFlavors(String vspId, Version version) {
final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
- Set<String> vspComputes = new HashSet<String>();
- for(DeploymentFlavorEntity entity : deploymentFlavorEntities) {
+ 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) {
+ if (componentComputeAssociations != null && !componentComputeAssociations.isEmpty()) {
+ for (ComponentComputeAssociation association : componentComputeAssociations) {
vspComputes.add(association.getComputeFlavorId());
}
}
@@ -199,32 +142,14 @@ public class ComputeManagerImpl implements ComputeManager {
return vspComputes;
}
- private boolean isComputeNameUnique(Collection<ComputeEntity> vfcComputeList, String name) {
- for (ComputeEntity compute : vfcComputeList) {
- if (compute.getComputeCompositionData().getName().equalsIgnoreCase(name)) {
- return false;
- }
- }
- return true;
- }
-
- private Collection<ComputeEntity> listCompute(String vspId, Version version,String componentId) {
- Collection<ComputeEntity> computeEntities =
- computeDao.list(new ComputeEntity(vspId, version, componentId, null));
-
- return computeEntities;
- }
-
@Override
public CompositionEntityResponse<ComputeData> getCompute(String vspId, Version version,
String componentId,
- String computeFlavorId, String user) {
+ String computeFlavorId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id, compute id", vspId,
componentId, computeFlavorId);
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
- ComputeEntity computeEntity = getCompute(vspId, version, componentId, computeFlavorId);
+ ComputeEntity computeEntity = getValidatedCompute(vspId, version, componentId, computeFlavorId);
ComputeData compute = computeEntity.getComputeCompositionData();
ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
@@ -242,9 +167,8 @@ public class ComputeManagerImpl implements ComputeManager {
return response;
}
- private ComputeEntity getCompute(String vspId, Version version, String componentId, String
- computeFlavorId) {
- //validateComponentId(vspId,version,componentId);
+ private ComputeEntity getValidatedCompute(String vspId, Version version, String componentId,
+ String computeFlavorId) {
ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId, version, componentId,
computeFlavorId));
VersioningUtil
@@ -253,186 +177,113 @@ public class ComputeManagerImpl implements ComputeManager {
return retrieved;
}
- /*private void validateComponentId(String vspId, Version version, String componentId) {
- ComponentEntity retrivedComponent = componentDao.get(new ComponentEntity(vspId, version,
- componentId));
- VersioningUtil
- .validateEntityExistence(retrivedComponent, new ComponentEntity(vspId, version,
- componentId),VspDetails.ENTITY_TYPE);
- }*/
-
@Override
public QuestionnaireResponse getComputeQuestionnaire(String vspId, Version version, String
- componentId, String computeId, String user) {
+ componentId, String computeId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, componentId", vspId, componentId, computeId);
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
- //validateComponentId(vspId,version,componentId);
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
- //validateComponentId(vspId,version,componentId);
- ComputeEntity computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, computeId);
+ ComputeEntity computeQuestionnaire =
+ computeDao.getQuestionnaireData(vspId, version, componentId, computeId);
VersioningUtil
- .validateEntityExistence(computeQuestionnaire, new ComputeEntity(vspId, version, componentId,
- computeId), VspDetails.ENTITY_TYPE);
+ .validateEntityExistence(computeQuestionnaire,
+ new ComputeEntity(vspId, version, componentId, computeId), VspDetails.ENTITY_TYPE);
questionnaireResponse.setData(computeQuestionnaire.getQuestionnaireData());
questionnaireResponse.setSchema(getComputeQuestionnaireSchema(null));
- mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId,
- componentId, computeId);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId, computeId);
return questionnaireResponse;
}
- protected String getComputeQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
-
- mdcDataDebugMessage.debugExitMessage(null, null);
- return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute,
- schemaInput);
- }
-
-
@Override
- public void updateComputeQuestionnaire(String vspId, Version version, String componentId, String
- computeId,
- String questionnaireData, String user) {
- mdcDataDebugMessage.debugEntryMessage("VSP id, component id, compute id", vspId,
- componentId, computeId);
+ public void updateComputeQuestionnaire(String vspId, Version version, String componentId,
+ String computeId, String questionnaireData) {
+ mdcDataDebugMessage
+ .debugEntryMessage("VSP id, component id, compute id", vspId, componentId, computeId);
- /*Version activeVersion =
- getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();
- getComponent(vspId, activeVersion, componentId);*/
- ComputeEntity retrieved = computeDao.get(new ComputeEntity(vspId,version,componentId,
+ 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);
- mdcDataDebugMessage.debugExitMessage("VSP id, component id, compute id", vspId,
- componentId, computeId);
+ mdcDataDebugMessage
+ .debugExitMessage("VSP id, component id, compute id", vspId, componentId, computeId);
}
@Override
- public CompositionEntityValidationData updateCompute(ComputeEntity compute, String user) {
+ public CompositionEntityValidationData updateCompute(ComputeEntity compute) {
mdcDataDebugMessage
- .debugEntryMessage("VSP id, component id", compute.getVspId(), compute.getComponentId(),
- compute.getId());
-
- /*Version activeVersion =
- getVersionInfo(image.getVspId(), VersionableEntityAction.Write, user).getActiveVersion();
- image.setVersion(activeVersion);*/
+ .debugEntryMessage("VSP id, component id", compute.getVspId(), compute.getComponentId(),
+ compute.getId());
- ComputeEntity retrieved = getComputeEntity(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
+ ComputeEntity retrieved =
+ getComputeEntity(compute.getVspId(), compute.getVersion(), compute.getComponentId(),
compute.getId());
- if(!vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) {
- final ComputeData computeCompositionData = compute.getComputeCompositionData();
- final String name = computeCompositionData.getName();
- //final String format = computeCompositionData.getFormat();
- validateHeatVspComputeUpdate("Name", name, retrieved.getComputeCompositionData()
- .getName());
- /*validateHeatVspComputeUpdate("format", format, retrieved.getComputeCompositionData()
- .getFormat());*/
+ boolean manual = vspInfoDao.isManual(compute.getVspId(), compute.getVersion());
+ if (!manual) {
+ validateHeatVspComputeUpdate("Name",
+ compute.getComputeCompositionData().getName(),
+ retrieved.getComputeCompositionData().getName());
}
- Collection<ComputeEntity> vfcComputeList = listComputes(compute.getVspId() ,
- compute.getVersion(), compute.getComponentId());
-
- //Set to null so that retrieved object is equal to one in list and gets removed.
- retrieved.setQuestionnaireData(null);
- vfcComputeList.remove(retrieved);
- if(vspInfoDao.isManual(compute.getVspId(), compute.getVersion()))
- validateVfcCompute(compute, vfcComputeList, LoggerTragetServiceName.UPDATE_COMPUTE);
-
- //Set format to default value in order to handle FTL validation when compute format is null
- /*if(compute.getComputeCompositionData().getFormat() == null)
- compute.getComputeCompositionData().setFormat(ComputeFormat.qcow2.name());*/
-
ComputeCompositionSchemaInput schemaInput = new ComputeCompositionSchemaInput();
schemaInput.setCompute(compute.getComputeCompositionData());
CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(compute, SchemaTemplateContext.composition, schemaInput);
+ .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);
}
mdcDataDebugMessage
- .debugExitMessage("VSP id, component id", compute.getVspId(), compute.getComponentId(),
- compute.getId());
+ .debugExitMessage("VSP id, component id", compute.getVspId(), compute.getComponentId(),
+ compute.getId());
return validationData;
}
private void validateHeatVspComputeUpdate(String name, String value, String retrivedValue) {
- if(value != null && !value.equals(retrivedValue)) {
+ if (value != null && !value.equals(retrivedValue)) {
final ErrorCode updateHeatComputeErrorBuilder =
- DuplicateComputeInComponentErrorBuilder.getComputeHeatReadOnlyErrorBuilder(name);
+ DuplicateComputeInComponentErrorBuilder.getComputeHeatReadOnlyErrorBuilder(name);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_COMPUTE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- updateHeatComputeErrorBuilder.message());
+ LoggerTragetServiceName.UPDATE_COMPUTE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+ updateHeatComputeErrorBuilder.message());
throw new CoreException(updateHeatComputeErrorBuilder);
}
}
- private void validateVfcCompute(ComputeEntity compute, Collection<ComputeEntity> vfcComputeList,
- String event) {
- if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(),
- compute.getId())) {
- ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder
- .getDuplicateComputeNameErrorBuilder(compute.getComputeCompositionData().getName(),
- compute.getComponentId());
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- event, ErrorLevel.ERROR.name(),
- errorCode.id(),errorCode.message());
-
- throw new CoreException(errorCode);
- }
- }
-
- private boolean isComputeNameDuplicate(Collection<ComputeEntity> computes, String name, String computeId) {
- for (ComputeEntity compute : computes) {
- if (compute.getComputeCompositionData().getName().equalsIgnoreCase(name) && !compute.getId().equals(computeId)) {
- return true;
- }
- }
- return false;
- }
-
-
private ComputeEntity getComputeEntity(String vspId, Version version, String componentId,
- String computeId) {
- //validateComponentId(vspId,version,componentId);
- ComputeEntity computeEntity = computeDao.get(new ComputeEntity(vspId, version, componentId, computeId));
- VersioningUtil.validateEntityExistence(computeEntity, new ComputeEntity(vspId, version, componentId,
- computeId), VspDetails.ENTITY_TYPE);
- return computeEntity;
- }
-
- private Collection<ComputeEntity> listComputes(String vspId, Version version, String componentId) {
- return computeDao.list(new ComputeEntity(vspId, version, componentId, null));
+ 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 void deleteCompute(String vspId, Version version, String componentId, String
- computeFlavorId, String user) {
+ public void deleteCompute(String vspId, Version version, String componentId,
+ String computeFlavorId) {
final String VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG =
"Composition entities may not be created / deleted for Vendor Software Product "
+ "whose entities were uploaded";
mdcDataDebugMessage.debugEntryMessage("VSP id, component id, compute id", vspId,
componentId, computeFlavorId);
- /*Version activeVersion =
- getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();*/
if (!vspInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_COMPUTE, ErrorLevel.ERROR.name(),
@@ -442,30 +293,32 @@ public class ComputeManagerImpl implements ComputeManager {
.withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED)
.withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build());
}
- ComputeEntity retrived = getCompute(vspId,version,componentId,computeFlavorId);
- if (retrived != null){
- deleteComputeFromDeploymentFlavors(vspId,version,computeFlavorId);
+ 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());
}
mdcDataDebugMessage.debugExitMessage("VSP id, component id, compute id", vspId,
componentId, computeFlavorId);
}
- private void deleteComputeFromDeploymentFlavors(String vspId, Version activeVersion,
+ private void deleteComputeFromDeploymentFlavors(String vspId, Version version,
String computeFlavorId) {
- //Collection<DeploymentFlavorEntity> listDF = listDeploymentFlavors(vspId, activeVersion);
- Collection<DeploymentFlavorEntity> listDF = deploymentFlavorDao.list(new DeploymentFlavorEntity
- (vspId, activeVersion, null));
- for(DeploymentFlavorEntity df : listDF) {
- DeploymentFlavorEntity deploymentFlavorEntity=removeComputeFromDF(df, computeFlavorId);
- if(deploymentFlavorEntity!=null)
+ 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) {
+ private DeploymentFlavorEntity removeComputeFromDF(DeploymentFlavorEntity df,
+ String computeFlavorId) {
DeploymentFlavor flavor = df.getDeploymentFlavorCompositionData();
List<ComponentComputeAssociation> associations = flavor.getComponentComputeAssociations();
if (associations != null) {
@@ -486,20 +339,47 @@ public class ComputeManagerImpl implements ComputeManager {
return null;
}
- protected String getComputeCompositionSchema(SchemaTemplateInput schemaInput){
- mdcDataDebugMessage.debugEntryMessage(null, null);
- mdcDataDebugMessage.debugExitMessage(null, null);
- return SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.compute, schemaInput);
+ protected String getComputeCompositionSchema(SchemaTemplateInput schemaInput) {
+ mdcDataDebugMessage.debugEntryMessage(null);
+ mdcDataDebugMessage.debugExitMessage(null);
+ return SchemaGenerator
+ .generate(SchemaTemplateContext.composition, CompositionEntityType.compute, schemaInput);
+ }
+
+ protected String getComputeQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+ mdcDataDebugMessage.debugEntryMessage(null);
+ mdcDataDebugMessage.debugExitMessage(null);
+ return SchemaGenerator
+ .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.compute, schemaInput);
}
- /*boolean isManual(String vspId, Version version) {
+ protected void validateUniqueName(String vspId, Version version, String componentId,
+ String name) {
+ UniqueValueUtil.validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME,
+ vspId, version.getId(), componentId, name);
+ }
- VspDetails vsp = vspInfoDao.get(new VspDetails(vspId, version));
- String onboardingMethod = vsp.getOnboardingMethod();
- if (MANUAL.equals(onboardingMethod)) {
- return true;
- }
- return false;
- }*/
+ protected void createUniqueName(String vspId, Version version, String componentId, String name) {
+ 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
+ .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, oldName,
+ newName, vspId, version.getId(), componentId);
+ }
+ protected void deleteUniqueValue(String vspId, Version version, String componentId, String name) {
+ if (componentId == null) {
+ UniqueValueUtil
+ .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME, vspId,
+ version.getId(), 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/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java
index 0873eaf921..f1acaae178 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
@@ -44,18 +44,14 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
private VendorSoftwareProductInfoDao vspInfoDao;
private DeploymentFlavorDao deploymentFlavorDao;
private CompositionEntityDataManager compositionEntityDataManager;
- private ComponentDao componentDao;
+ private ComponentDao componentDao;
private ComputeDao computeDao;
- public DeploymentFlavorManagerImpl(
- VendorSoftwareProductInfoDao vspInfoDao,
- DeploymentFlavorDao deploymentFlavorDao,
- CompositionEntityDataManager compositionEntityDataManager,
- ComponentDao componentDao,
- ComputeDao computeDao
-
- ) {
-
+ public DeploymentFlavorManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
+ DeploymentFlavorDao deploymentFlavorDao,
+ CompositionEntityDataManager compositionEntityDataManager,
+ ComponentDao componentDao,
+ ComputeDao computeDao) {
this.vspInfoDao = vspInfoDao;
this.deploymentFlavorDao = deploymentFlavorDao;
this.compositionEntityDataManager = compositionEntityDataManager;
@@ -65,31 +61,17 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
}
@Override
- public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version,
- String user) {
+ public Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
-
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return listDeploymentFlavors(vspId, version);
- }
-
- private Collection<DeploymentFlavorEntity> listDeploymentFlavors(String vspId, Version version) {
- Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
- deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
- return deploymentFlavorEntities;
+ return deploymentFlavorDao.list(new DeploymentFlavorEntity(vspId, version, null));
}
@Override
public DeploymentFlavorEntity createDeploymentFlavor(
- DeploymentFlavorEntity deploymentFlavorEntity, String user) {
- DeploymentFlavorEntity createDeploymentFlavor = null;
+ DeploymentFlavorEntity deploymentFlavorEntity) {
+ DeploymentFlavorEntity createDeploymentFlavor;
mdcDataDebugMessage.debugEntryMessage("VSP id ", deploymentFlavorEntity.getVspId());
- /*Version activeVersion =
- getVersionInfo(deploymentFlavorEntity.getVspId(), VersionableEntityAction.Write, user)
- .getActiveVersion();
- deploymentFlavorEntity.setVersion(activeVersion);*/
if (!vspInfoDao.isManual(deploymentFlavorEntity.getVspId(),
deploymentFlavorEntity.getVersion())) {
@@ -100,31 +82,30 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), deploymentFlavorErrorBuilder.message());
throw new CoreException(deploymentFlavorErrorBuilder);
} else {
- validateDeploymentFlavor(deploymentFlavorEntity, user, deploymentFlavorEntity.getVersion());
+ validateDeploymentFlavor(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
createDeploymentFlavor =
compositionEntityDataManager.createDeploymentFlavor(deploymentFlavorEntity);
}
return createDeploymentFlavor;
}
- private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity, String
- user, Version activeVersion) {
-
+ private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity,
+ Version version) {
//Validation for unique model.
Collection<DeploymentFlavorEntity> listDeploymentFlavors =
listDeploymentFlavors(deploymentFlavorEntity.getVspId(),
- activeVersion);
+ version);
isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
List<String> featureGroups =
- getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), user, activeVersion);
+ getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), version);
String featureGroup = deploymentFlavorEntity.getDeploymentFlavorCompositionData()
.getFeatureGroupId();
- if (featureGroup != null && featureGroup.trim().length()>0) {
+ if (featureGroup != null && featureGroup.trim().length() > 0) {
if (isEmpty(featureGroups) || (!(validFeatureGroup(featureGroups, featureGroup)))) {
ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder
.getFeatureGroupNotexistErrorBuilder(featureGroup, deploymentFlavorEntity.getVspId(),
- activeVersion);
+ version);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.CREATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), deploymentFlavorErrorBuilder.message());
@@ -132,7 +113,7 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
}
}
- validateComponentComputeAssociation(deploymentFlavorEntity, activeVersion);
+ validateComponentComputeAssociation(deploymentFlavorEntity, version);
}
private void isDeploymentFlavorModelDuplicate(DeploymentFlavorEntity deploymentFlavorEntity,
@@ -152,14 +133,8 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
});
}
- private List<String> getFeatureGroupListForVsp(String vspId,
- String user, Version activeVersion) {
- /*VersionedVendorSoftwareProductInfo versionedVendorSoftwareProductInfo = getVspDetails(
- vspId,activeVersion, user);
- return versionedVendorSoftwareProductInfo.getVspDetails()
- .getFeatureGroups();*/
-
- final VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, activeVersion));
+ private List<String> getFeatureGroupListForVsp(String vspId, Version version) {
+ final VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
return vspDetails.getFeatureGroups();
}
@@ -183,7 +158,7 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
}
private void validateComponentComputeAssociation(DeploymentFlavorEntity deploymentFlavorEntity,
- Version activeVersion) {
+ Version version) {
List<ComponentComputeAssociation> componentComputeAssociationList = deploymentFlavorEntity
.getDeploymentFlavorCompositionData().getComponentComputeAssociations();
List<String> vfcList = new ArrayList<>();
@@ -201,14 +176,14 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
LoggerErrorCode.DATA_ERROR.getErrorCode(), invalidAssociationErrorBuilder.message());
throw new CoreException(invalidAssociationErrorBuilder);
} else if (componentComputeAssociation.getComponentId() != null &&
- componentComputeAssociation.getComponentId().trim().length() > 0 ) {
- ComponentEntity component = getComponent(deploymentFlavorEntity.getVspId(), activeVersion,
+ componentComputeAssociation.getComponentId().trim().length() > 0) {
+ ComponentEntity component = getComponent(deploymentFlavorEntity.getVspId(), version,
componentComputeAssociation.getComponentId());
if (componentComputeAssociation
.getComputeFlavorId() != null && componentComputeAssociation
- .getComputeFlavorId().trim().length() > 0 ) {
+ .getComputeFlavorId().trim().length() > 0) {
ComputeEntity computeFlavor = computeDao.get(new ComputeEntity(deploymentFlavorEntity
- .getVspId(), activeVersion, componentComputeAssociation.getComponentId(),
+ .getVspId(), version, componentComputeAssociation.getComponentId(),
componentComputeAssociation.getComputeFlavorId()));
if (computeFlavor == null) {
ErrorCode invalidComputeIdErrorBuilder = DeploymentFlavorErrorBuilder
@@ -251,22 +226,19 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
@Override
public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavor(String vspId,
Version version,
- String deploymentFlavorId,
- String user) {
+ String deploymentFlavorId) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, deployment flavor id", vspId, deploymentFlavorId);
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
- DeploymentFlavorEntity deploymentFlavorEntity = getDeploymentFlavor(vspId,version,
- 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, user, version);
+ getFeatureGroupListForVsp(vspId, version);
schemaInput.setFeatureGroupIds(featureGroups);
CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
response.setId(deploymentFlavorId);
@@ -280,27 +252,24 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
return response;
}
- private DeploymentFlavorEntity getDeploymentFlavor(String vspId, Version version, String
+ 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);
+ deploymentFlavorId), VspDetails.ENTITY_TYPE);
return retrieved;
}
@Override
public CompositionEntityResponse<DeploymentFlavor> getDeploymentFlavorSchema(String vspId,
- Version version,
- String user) {
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
- DeploymentFlavorCompositionSchemaInput schemaInput= new
- DeploymentFlavorCompositionSchemaInput();
+ Version version) {
+ DeploymentFlavorCompositionSchemaInput schemaInput =
+ new DeploymentFlavorCompositionSchemaInput();
schemaInput.setManual(vspInfoDao.isManual(vspId, version));
List<String> featureGroups =
- getFeatureGroupListForVsp(vspId, user, version);
+ getFeatureGroupListForVsp(vspId, version);
schemaInput.setFeatureGroupIds(featureGroups);
CompositionEntityResponse<DeploymentFlavor> response = new CompositionEntityResponse<>();
response.setSchema((SchemaGenerator
@@ -310,14 +279,13 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
}
@Override
- public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId,
- String user) {
+ public void deleteDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, deployment flavor id", vspId, deploymentFlavorId);
/*Version activeVersion =
getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();*/
- DeploymentFlavorEntity deploymentFlavorEntity = getDeploymentFlavor(vspId,version,
- deploymentFlavorId);
+ DeploymentFlavorEntity deploymentFlavorEntity =
+ getValidatedDeploymentFlavor(vspId, version, deploymentFlavorId);
if (!vspInfoDao.isManual(vspId, version)) {
final ErrorCode deleteDeploymentFlavorErrorBuilder =
NotSupportedHeatOnboardMethodErrorBuilder
@@ -328,7 +296,7 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
deleteDeploymentFlavorErrorBuilder.message());
throw new CoreException(deleteDeploymentFlavorErrorBuilder);
}
- if(deploymentFlavorEntity != null) {
+ if (deploymentFlavorEntity != null) {
deploymentFlavorDao.delete(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId));
}
@@ -336,8 +304,8 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
.debugExitMessage("VSP id, deployment flavor id", vspId, deploymentFlavorId);
}
- public CompositionEntityValidationData updateDeploymentFlavor(DeploymentFlavorEntity
- deploymentFlavorEntity, String user) {
+ public CompositionEntityValidationData updateDeploymentFlavor(
+ DeploymentFlavorEntity deploymentFlavorEntity) {
mdcDataDebugMessage.debugEntryMessage("VSP id, deploymentFlavor id", deploymentFlavorEntity
.getVspId(), deploymentFlavorEntity.getId());
/*Version activeVersion =
@@ -355,9 +323,9 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
updateDeploymentFlavorErrorBuilder.message());
throw new CoreException(updateDeploymentFlavorErrorBuilder);
}
- //deploymentFlavorEntity.setVersion(activeVersion);
DeploymentFlavorEntity retrieved =
- getDeploymentFlavor(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion(),
+ getValidatedDeploymentFlavor(deploymentFlavorEntity.getVspId(),
+ deploymentFlavorEntity.getVersion(),
deploymentFlavorEntity.getId());
@@ -367,7 +335,8 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
isDeploymentFlavorModelDuplicate(deploymentFlavorEntity, listDeploymentFlavors);
//validateComponentComputeAssociation(deploymentFlavorEntity, activeVersion);
- validateComponentComputeAssociation(deploymentFlavorEntity, deploymentFlavorEntity.getVersion());
+ validateComponentComputeAssociation(deploymentFlavorEntity,
+ deploymentFlavorEntity.getVersion());
DeploymentFlavorCompositionSchemaInput schemaInput = new
DeploymentFlavorCompositionSchemaInput();
@@ -376,7 +345,7 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager {
schemaInput.setDeploymentFlavor(retrieved.getDeploymentFlavorCompositionData());
List<String> featureGroups =
- getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(), user,
+ getFeatureGroupListForVsp(deploymentFlavorEntity.getVspId(),
deploymentFlavorEntity.getVersion());
schemaInput.setFeatureGroupIds(featureGroups);
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 82b71399aa..0429ba4de8 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
@@ -37,72 +37,49 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
import java.util.stream.Collectors;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
public class ImageManagerImpl implements ImageManager {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorSoftwareProductInfoDao vspInfoDao;
private ImageDao imageDao;
private CompositionEntityDataManager compositionEntityDataManager;
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
- public ImageManagerImpl(
- VendorSoftwareProductInfoDao vspInfoDao,
- ImageDao imageDao,
- CompositionEntityDataManager compositionEntityDataManager
-
- ) {
-
+ public ImageManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
+ ImageDao imageDao,
+ CompositionEntityDataManager compositionEntityDataManager) {
this.vspInfoDao = vspInfoDao;
this.imageDao = imageDao;
this.compositionEntityDataManager = compositionEntityDataManager;
-
}
@Override
- public ImageEntity createImage(ImageEntity imageEntity, String user) {
- /*Version activeVersion = getVersionInfo(imageEntity.getVspId(),
- VersionableEntityAction.Write, user).getActiveVersion();
-
- imageEntity.setVersion(activeVersion);*/
+ public ImageEntity createImage(ImageEntity imageEntity) {
boolean isManual = vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion());
if (!isManual) {
-
ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder
- .getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
+ .getAddImageNotSupportedHeatOnboardMethodErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_IMAGE, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message());
+ LoggerTragetServiceName.CREATE_IMAGE, ErrorLevel.ERROR.name(),
+ errorCode.id(), errorCode.message());
throw new CoreException(errorCode);
}
-
- /*Collection<ImageEntity> vfcImageList = listImages(imageEntity.getVspId() ,
- imageEntity.getVersion(), imageEntity.getComponentId());*/
compositionEntityDataManager.createImage(imageEntity);
return imageEntity;
}
@Override
- public Collection<ImageEntity> listImages(String vspId, Version version, String componentId,
- String user) {
+ public Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
- Collection<ImageEntity> imageEntities = listImages(vspId, version, componentId);
+ Collection<ImageEntity> imageEntities =
+ imageDao.list(new ImageEntity(vspId, version, componentId, null));
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
-
return imageEntities;
}
- private Collection<ImageEntity> listImages(String vspId, Version version, String componentId) {
- return imageDao.list(new ImageEntity(vspId, version, componentId, null));
- }
-
@Override
- public CompositionEntityResponse getImageSchema(String vspId, String user) {
+ public CompositionEntityResponse<Image> getImageSchema(String vspId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, image id", vspId);
CompositionEntityResponse<Image> response = new CompositionEntityResponse<>();
@@ -118,14 +95,10 @@ public class ImageManagerImpl implements ImageManager {
@Override
public CompositionEntityResponse<Image> getImage(String vspId, Version version, String
- componentId, String imageId, String user) {
+ componentId, String imageId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, componentId, image id", vspId, componentId,
- imageId);
-
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));*/
-
+ imageId);
ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
Image image = imageEntity.getImageCompositionData();
@@ -142,25 +115,21 @@ public class ImageManagerImpl implements ImageManager {
response.setSchema(getImageCompositionSchema(schemaInput));
mdcDataDebugMessage.debugExitMessage("VSP id, componentId, image id", vspId, componentId,
- imageId);
+ imageId);
return response;
}
@Override
public QuestionnaireResponse getImageQuestionnaire(String vspId, Version version, String
- componentId, String imageId, String user) {
+ componentId, String imageId) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
-
- /*version = VersioningUtil
- .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user));
- validateComponentId(vspId,version,componentId);*/
QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
//validateComponentId(vspId,version,componentId);
ImageEntity retrieved = imageDao.getQuestionnaireData(vspId, version, componentId, imageId);
VersioningUtil.validateEntityExistence(retrieved, new ImageEntity(vspId, version, componentId,
- imageId), ComponentEntity.ENTITY_TYPE);
+ imageId), ComponentEntity.ENTITY_TYPE);
questionnaireResponse.setData(retrieved.getQuestionnaireData());
questionnaireResponse.setSchema(getImageQuestionnaireSchema(null));
@@ -170,72 +139,63 @@ public class ImageManagerImpl implements ImageManager {
}
@Override
- public void deleteImage(String vspId, Version version, String componentId, String imageId, String
- user) {
+ public void deleteImage(String vspId, Version version, String componentId, String imageId) {
mdcDataDebugMessage
- .debugEntryMessage("VSP id, component id", vspId, componentId, imageId);
-
- /*Version activeVersion =
- getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();
- ComponentEntity component = getComponent(vspId, activeVersion, componentId);*/
+ .debugEntryMessage("VSP id, component id", vspId, componentId, imageId);
ImageEntity imageEntity = getImageEntity(vspId, version, componentId, imageId);
if (!vspInfoDao.isManual(vspId, version)) {
final ErrorCode deleteImageErrorBuilder =
- NotSupportedHeatOnboardMethodErrorBuilder
- .getDelImageNotSupportedHeatOnboardMethodErrorBuilder();
+ NotSupportedHeatOnboardMethodErrorBuilder
+ .getDelImageNotSupportedHeatOnboardMethodErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.DELETE_IMAGE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- deleteImageErrorBuilder.message());
+ LoggerTragetServiceName.DELETE_IMAGE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+ deleteImageErrorBuilder.message());
throw new CoreException(deleteImageErrorBuilder);
}
if (imageEntity != null) {
imageDao.delete(new ImageEntity(vspId, version, componentId, imageId));
}
mdcDataDebugMessage
- .debugExitMessage("VSP id, component id", vspId, componentId, imageId);
+ .debugExitMessage("VSP id, component id", vspId, componentId, imageId);
}
private void validateHeatVspImageUpdate(String name, String value, String retrivedValue) {
-
- if(value != null && !value.equals(retrivedValue)) {
-
+ if (value != null && !value.equals(retrivedValue)) {
final ErrorCode updateHeatImageErrorBuilder =
- ImageErrorBuilder.getImageHeatReadOnlyErrorBuilder(name);
+ ImageErrorBuilder.getImageHeatReadOnlyErrorBuilder(name);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
- updateHeatImageErrorBuilder.message());
+ LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
+ updateHeatImageErrorBuilder.message());
throw new CoreException(updateHeatImageErrorBuilder);
}
}
@Override
- public CompositionEntityValidationData updateImage(ImageEntity image, String user) {
+ public CompositionEntityValidationData updateImage(ImageEntity image) {
mdcDataDebugMessage
- .debugEntryMessage("VSP id, component id", image.getVspId(), image.getComponentId(),
- image.getId());
+ .debugEntryMessage("VSP id, component id", image.getVspId(), image.getComponentId(),
+ image.getId());
- /*Version activeVersion =
- getVersionInfo(image.getVspId(), VersionableEntityAction.Write, user).getActiveVersion();
- image.setVersion(activeVersion);*/
boolean isManual = vspInfoDao.isManual(image.getVspId(), image.getVersion());
- ImageEntity retrieved = getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(),
+ ImageEntity retrieved =
+ getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(),
image.getId());
- if(!isManual) {
+ if (!isManual) {
final Image imageCompositionData = image.getImageCompositionData();
final String fileName = imageCompositionData.getFileName();
//final String format = imageCompositionData.getFormat();
validateHeatVspImageUpdate("fileName", fileName, retrieved.getImageCompositionData()
- .getFileName());
+ .getFileName());
/*validateHeatVspImageUpdate("format", format, retrieved.getImageCompositionData()
.getFormat());*/
}
- Collection<ImageEntity> vfcImageList = listImages(image.getVspId() ,
- image.getVersion(), image.getComponentId());
+ 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);
@@ -249,50 +209,45 @@ public class ImageManagerImpl implements ImageManager {
schemaInput.setImage(image.getImageCompositionData());
CompositionEntityValidationData validationData = compositionEntityDataManager
- .validateEntity(image, SchemaTemplateContext.composition, schemaInput);
+ .validateEntity(image, SchemaTemplateContext.composition, schemaInput);
if (CollectionUtils.isEmpty(validationData.getErrors())) {
imageDao.update(image);
}
mdcDataDebugMessage
- .debugExitMessage("VSP id, component id", image.getVspId(), image.getComponentId(),
- image.getId());
+ .debugExitMessage("VSP id, component id", image.getVspId(), image.getComponentId(),
+ image.getId());
return validationData;
}
@Override
public void updateImageQuestionnaire(String vspId, Version version, String componentId, String
- imageId, String questionnaireData, String user) {
+ imageId, String questionnaireData) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id, imageId", vspId, componentId,
- imageId);
+ imageId);
getImageEntity(vspId, version, componentId, imageId);
- /*Version activeVersion =
- getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion();
-
- getComponent(vspId, activeVersion, componentId);*/
final ImageDetails image = JsonUtil.json2Object(questionnaireData, ImageDetails.class);
final String format = image.getFormat();
try {
if (format != null) {
- final ImageFormat imageFormat = ImageFormat.valueOf(format);
+ ImageFormat.valueOf(format);
}
} catch (IllegalArgumentException exception) {
- log.debug("", exception);
ErrorCode errorCode = ImageErrorBuilder.getInvalidImageFormatErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
- errorCode.id(), errorCode.message() );
+ LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
+ errorCode.id(), errorCode.message());
throw new CoreException(errorCode);
}
//Validate Format is read only for HEAT Onboarding
if (!vspInfoDao.isManual(vspId, version)) {
final QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version,
- componentId, imageId, user);
+ componentId, imageId);
final String data = imageQuestionnaire.getData();
if (data != null) {
String retrivedFormat = JsonUtil.json2Object(data, ImageDetails.class).getFormat();
@@ -300,34 +255,33 @@ public class ImageManagerImpl implements ImageManager {
}
}
- if(!isImageVersionUnique(vspId, version, componentId, imageId, image, user))
- {
+ if (!isImageVersionUnique(vspId, version, componentId, imageId, image)) {
ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageVersionErrorBuilder(image
- .getVersion(), componentId);
+ .getVersion(), componentId);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
- errorCode.id(),errorCode.message());
+ LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(),
+ errorCode.id(), errorCode.message());
throw new CoreException(errorCode);
}
imageDao.updateQuestionnaireData(vspId, version, componentId, imageId, questionnaireData);
mdcDataDebugMessage.debugExitMessage("VSP id, component id, imageId", vspId, componentId,
- imageId);
+ imageId);
}
- private boolean isImageVersionUnique(String vspId, Version version, String componentId, String imageId,
- ImageDetails image, String user)
- {
+ 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, user))
+ 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);
@@ -337,14 +291,17 @@ public class ImageManagerImpl implements ImageManager {
return isPresent;
}
- private String getImageVersion(String vspId, Version version, String componentId, ImageEntity imageEntity, String user)
- {
+ private String getImageVersion(String vspId, Version version, String componentId,
+ ImageEntity imageEntity) {
QuestionnaireResponse imageQuestionnaire = getImageQuestionnaire(vspId, version,
- componentId, imageEntity.getId(), user);
- ImageDetails imageDetails = JsonUtil.json2Object(imageQuestionnaire.getData(), ImageDetails.class);
+ componentId, imageEntity.getId());
+ ImageDetails imageDetails =
+ JsonUtil.json2Object(imageQuestionnaire.getData(), ImageDetails.class);
- return imageDetails==null?null:imageDetails.getVersion()!=null?imageDetails.getVersion().trim():null;
+ return imageDetails == null ? null
+ : imageDetails.getVersion() != null ? imageDetails.getVersion().trim() : null;
}
+
private ImageEntity getImageEntity(String vspId, Version version, String componentId,
String imageId) {
//validateComponentId(vspId,version,componentId);
@@ -352,34 +309,24 @@ public class ImageManagerImpl implements ImageManager {
ImageEntity imageEntity = imageDao.get(new ImageEntity(vspId, version, componentId, imageId));
VersioningUtil.validateEntityExistence(imageEntity, new ImageEntity(vspId, version, componentId,
- imageId), VspDetails.ENTITY_TYPE);
+ imageId), VspDetails.ENTITY_TYPE);
return imageEntity;
}
-
- private boolean isImageNameDuplicate(Collection<ImageEntity> images, String fileName) {
- for (ImageEntity image : images) {
- if (image.getImageCompositionData().getFileName().equalsIgnoreCase(fileName)) {
- return true;
- }
- }
- return false;
- }
-
protected String getImageCompositionSchema(SchemaTemplateInput schemaInput) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
- mdcDataDebugMessage.debugExitMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
+ mdcDataDebugMessage.debugExitMessage(null);
return SchemaGenerator
- .generate(SchemaTemplateContext.composition, CompositionEntityType.image,
- schemaInput);
+ .generate(SchemaTemplateContext.composition, CompositionEntityType.image,
+ schemaInput);
}
protected String getImageQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
- mdcDataDebugMessage.debugExitMessage(null, null);
+ mdcDataDebugMessage.debugExitMessage(null);
return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image,
- schemaInput);
+ .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 8bdc7fdfce..fdb9621bcb 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
@@ -6,8 +6,6 @@ import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService
import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
@@ -29,18 +27,15 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
private ManualVspDataCollectionService
manualVspDataCollectionService = new ManualVspDataCollectionService();
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
@Override
- public VspModelInfo gatherVspInformation(String vspId, Version version, String user) {
+ public VspModelInfo gatherVspInformation(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage(null, null);
VspModelInfo vspModelInfo = new VspModelInfo();
//Get Release Vendor Name
Optional<String> releaseVendor;
try {
- releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version, user);
+ releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version);
} catch (Exception ex) {
- log.debug("", ex);
releaseVendor = Optional.empty();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
@@ -52,9 +47,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
//Get Allowed Deployment flavors information
Map<String, DeploymentFlavorModel> allowedFlavors;
try {
- allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version, user);
+ allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version);
} catch (Exception ex) {
- log.debug("", ex);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors : "
@@ -69,9 +63,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
Map<String, List<MultiFlavorVfcImage>> vspComponentImages;
try {
vspComponentImages =
- manualVspDataCollectionService.getVspComponentImages(vspId, version, user);
+ manualVspDataCollectionService.getVspComponentImages(vspId, version);
} catch (Exception ex) {
- log.debug("", ex);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images : "
@@ -85,9 +78,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
//Get VFC component information
Map<String, String> vspComponents;
try {
- vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version, user);
+ vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version);
} catch (Exception ex) {
- log.debug("", ex);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components : "
@@ -101,9 +93,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager {
//Get VSP component nic information
Map<String, List<Nic>> vspComponentNics;
try {
- vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version, user);
+ vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version);
} catch (Exception ex) {
- log.debug("", ex);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics : "
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 6569312f02..eed566de43 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
@@ -20,15 +20,13 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
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(),
- ActivityLogManagerFactory.getInstance().createInterface());
+ new MonitoringUploadsManagerImpl(MonitoringUploadDaoFactory.getInstance().createInterface());
@Override
public MonitoringUploadsManager createInterface() {
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 0f4d73f8c5..bcfdefbd0c 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
@@ -26,8 +26,6 @@ import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
-import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.common.utils.CommonUtil;
@@ -45,7 +43,6 @@ import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.MonitoringUploadErrorBuilder;
@@ -53,7 +50,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringU
import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
-import org.openecomp.sdcrests.activitylog.types.ActivityType;
import java.io.IOException;
import java.io.InputStream;
@@ -67,26 +63,20 @@ import java.util.Optional;
public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
- private ActivityLogManager activityLogManager;
private ComponentArtifactDao componentArtifactDao;
- private VendorSoftwareProductDao vendorSoftwareProductDao;
private static final Logger logger =
LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
- MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao,
- ActivityLogManager activityLogManager) {
+ MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao) {
this.componentArtifactDao = componentArtifactDao;
- this.activityLogManager = activityLogManager;
componentArtifactDao.registerVersioning(
VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
}
@Override
public void delete(String vspId, Version version, String componentId,
- MonitoringUploadType monitoringUploadType, String user) {
+ MonitoringUploadType monitoringUploadType) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
ComponentMonitoringUploadEntity componentMonitoringUploadEntity =
@@ -112,8 +102,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
@Override
public void upload(InputStream object, String filename, String vspId,
Version version, String componentId,
- MonitoringUploadType type,
- String user) {
+ MonitoringUploadType type) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
if (object == null) {
@@ -130,7 +119,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
final FileContentHandler upload =
validateZip(vspId, version, uploadedFileData, errors);
if (type.equals(MonitoringUploadType.VES_EVENTS)) {
- validateVesEventUpload(upload, errors, vspId, version);
+ validateVesEventUpload(upload, errors);
}
if (MapUtils.isNotEmpty(errors)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -147,27 +136,18 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
uploadedFileData);
} catch (Exception exception) {
- log.debug("", exception);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid " + type.toString() + "zip file");
throw new CoreException(new MonitoringUploadErrorBuilder(exception.getMessage()).build());
}
}
-
- ActivityLogEntity activityLogEntity =
- new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
- ActivityType.UPLOAD_MONITORING_FILE.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
logger.audit("Uploaded Monitoring File for component id:" + componentId + " ,vspId:" + vspId);
-
-
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
}
private void validateVesEventUpload(FileContentHandler upload,
- Map<String, List<ErrorMessage>> errors, String vspId,
- Version version) {
+ Map<String, List<ErrorMessage>> errors) {
if (!CommonUtil.validateAllFilesYml(upload)) {
ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
.add(new ErrorMessage(ErrorLevel.ERROR,
@@ -194,8 +174,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
}
@Override
- public MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId,
- String user) {
+ public MonitoringUploadStatus listFilenames(String vspId, Version version, String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
ComponentMonitoringUploadEntity current =
@@ -259,10 +238,10 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
Map<String, List<ErrorMessage>> errors) {
FileContentHandler contentMap;
try {
- contentMap = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData);
+ contentMap =
+ CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData);
VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
} catch (IOException exception) {
- log.debug("", exception);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.VALIDATE_MONITORING_FILE, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid Monitoring zip file");
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 77b6b0039e..e6233bb79c 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
@@ -59,7 +59,7 @@ public class NetworkManagerImpl implements NetworkManager {
}
@Override
- public Collection<NetworkEntity> listNetworks(String vspId, Version version, String user) {
+ public Collection<NetworkEntity> listNetworks(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
@@ -67,7 +67,7 @@ public class NetworkManagerImpl implements NetworkManager {
}
@Override
- public NetworkEntity createNetwork(NetworkEntity network, String user) {
+ public NetworkEntity createNetwork(NetworkEntity network) {
mdcDataDebugMessage.debugEntryMessage("VSP id", network.getVspId());
if (!isManual(network.getVspId(), network.getVersion())) {
@@ -87,16 +87,12 @@ public class NetworkManagerImpl implements NetworkManager {
return null;
}
- private NetworkEntity createNetwork(NetworkEntity network) {
- return compositionEntityDataManager.createNetwork(network);
- }
-
@Override
- public CompositionEntityValidationData updateNetwork(NetworkEntity network, String user) {
+ public CompositionEntityValidationData updateNetwork(NetworkEntity network) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, network id", network.getVspId(), network.getId());
- NetworkEntity retrieved = getNetwork(network.getVspId(), network.getVersion(), network.getId());
+ NetworkEntity retrieved = getValidatedNetwork(network.getVspId(), network.getVersion(), network.getId());
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
schemaInput.setManual(isManual(network.getVspId(), network.getVersion()));
@@ -119,10 +115,10 @@ public class NetworkManagerImpl implements NetworkManager {
@Override
public CompositionEntityResponse<Network> getNetwork(String vspId, Version version,
- String networkId, String user) {
+ String networkId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, network id", vspId, networkId);
- NetworkEntity networkEntity = getNetwork(vspId, version, networkId);
+ NetworkEntity networkEntity = getValidatedNetwork(vspId, version, networkId);
Network network = networkEntity.getNetworkCompositionData();
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
@@ -140,7 +136,7 @@ public class NetworkManagerImpl implements NetworkManager {
}
- private NetworkEntity getNetwork(String vspId, Version version, String networkId) {
+ 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);
@@ -148,7 +144,7 @@ public class NetworkManagerImpl implements NetworkManager {
}
@Override
- public void deleteNetwork(String vspId, Version version, String networkId, String user) {
+ public void deleteNetwork(String vspId, Version version, String networkId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, network id", vspId, networkId);
if (!isManual(vspId, version)) {
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 0304353113..f2bb0baf95 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
@@ -37,7 +37,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.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
@@ -63,7 +68,7 @@ public class NicManagerImpl implements NicManager {
private NicDao nicDao;
private CompositionEntityDataManager compositionEntityDataManager;
private NetworkManager networkManager;
- private VendorSoftwareProductInfoDao vspInfoDao;
+ private VendorSoftwareProductInfoDao vspInfoDao;
public NicManagerImpl(NicDao nicDao,
CompositionEntityDataManager compositionEntityDataManager,
@@ -76,14 +81,13 @@ public class NicManagerImpl implements NicManager {
}
@Override
- public Collection<NicEntity> listNics(String vspId, Version version, String componentId,
- String user) {
+ public Collection<NicEntity> listNics(String vspId, Version version, String componentId) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentId, null));
if (!nics.isEmpty()) {
- Map<String, String> networksNameById = listNetworksNameById(vspId, version, user);
+ Map<String, String> networksNameById = listNetworksNameById(vspId, version);
nics.forEach(nicEntity -> {
Nic nic = nicEntity.getNicCompositionData();
nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
@@ -96,18 +100,18 @@ public class NicManagerImpl implements NicManager {
return nics;
}
- private Map<String, String> listNetworksNameById(String vspId, Version version, String user) {
- Collection<NetworkEntity> networks = networkManager.listNetworks(vspId, version, user);
+ 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, String user) {
- NicEntity createdNic = null;
+ public NicEntity createNic(NicEntity nic) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", nic.getVspId(),
nic.getComponentId());
+ NicEntity createdNic;
if (!vspInfoDao.isManual(nic.getVspId(), nic.getVersion())) {
ErrorCode onboardingMethodUpdateErrorCode = NotSupportedHeatOnboardMethodErrorBuilder
.getAddNicNotSupportedHeatOnboardMethodErrorBuilder();
@@ -117,25 +121,20 @@ public class NicManagerImpl implements NicManager {
onboardingMethodUpdateErrorCode.message());
throw new CoreException(onboardingMethodUpdateErrorCode);
} else {
- validateNic(nic, user);
- createdNic = createNic(nic);
+ validateNic(nic);
+ createdNic = compositionEntityDataManager.createNic(nic);
}
- //nicDao.updateVspLatestModificationTime(nic.getVspId(), nic.getVersion());
-
mdcDataDebugMessage
.debugExitMessage("VSP id, component id", nic.getVspId(), nic.getComponentId());
return createdNic;
}
- private NicEntity createNic(NicEntity nic) {
- return compositionEntityDataManager.createNic(nic);
- }
- private void validateNic(NicEntity nic, String user) {
+ private void validateNic(NicEntity nic) {
Collection<NicEntity> listNics = listNics(nic.getVspId(), nic.getVersion(), nic
- .getComponentId(), user);
+ .getComponentId());
String networkId = nic.getNicCompositionData().getNetworkId();
NetworkType networkType = nic.getNicCompositionData().getNetworkType();
String networkDescription = nic.getNicCompositionData().getNetworkDescription();
@@ -171,14 +170,12 @@ public class NicManagerImpl implements NicManager {
if (!(networkId == null || networkId.equals(""))) {
//NetworkEntity ne = getNetwork(nic.getVspId(), activeVersion, networkId);
final CompositionEntityResponse<Network> network =
- networkManager.getNetwork(nic.getVspId(), nic.getVersion(), networkId,
- user);
+ networkManager.getNetwork(nic.getVspId(), nic.getVersion(), networkId);
}
if (!(networkDescription == null || networkDescription.equals(""))) {
final ErrorCode nicNetworkDescriptionErrorBuilder =
- new NicInternalNetworkErrorBuilder()
- .getNetworkDescriptionInternalNetworkErrorBuilder();
+ NicInternalNetworkErrorBuilder.getNetworkDescriptionInternalNetworkErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), nicNetworkDescriptionErrorBuilder.message());
@@ -200,17 +197,17 @@ public class NicManagerImpl implements NicManager {
@Override
public CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId,
- String nicId, String user) {
+ String nicId) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, component id, nic id", vspId, componentId, nicId);
- NicEntity nicEntity = getNic(vspId, version, componentId, 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, user);
+ Map<String, String> networksNameById = listNetworksNameById(vspId, version);
nic.setNetworkName(networksNameById.get(nic.getNetworkId()));
schemaInput.setNetworkIds(networksNameById.keySet());
@@ -226,7 +223,8 @@ public class NicManagerImpl implements NicManager {
}
- private NicEntity getNic(String vspId, Version version, String componentId, String nicId) {
+ 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),
@@ -235,14 +233,13 @@ public class NicManagerImpl implements NicManager {
}
@Override
- public void deleteNic(String vspId, Version version, String componentId, String nicId,
- String user) {
+ public void deleteNic(String vspId, Version version, String componentId, String nicId) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, component id", vspId, componentId, nicId);
if (!vspInfoDao.isManual(vspId, version)) {
final ErrorCode deleteNicErrorBuilder =
- new DeleteNicErrorBuilder().getDeleteNicForHeatOnboardedVspErrorBuilder();
+ DeleteNicErrorBuilder.getDeleteNicForHeatOnboardedVspErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_NIC, ErrorLevel.ERROR.name(),
LoggerErrorCode.PERMISSION_ERROR.getErrorCode(),
@@ -250,23 +247,21 @@ public class NicManagerImpl implements NicManager {
throw new CoreException(deleteNicErrorBuilder);
}
- NicEntity nicEntity = getNic(vspId, version, componentId, nicId);
- if (nicEntity != null) {
- nicDao.delete(nicEntity);
- }
+ NicEntity nicEntity = getValidatedNic(vspId, version, componentId, nicId);
+ nicDao.delete(nicEntity);
mdcDataDebugMessage
.debugExitMessage("VSP id, component id", vspId, componentId, nicId);
}
@Override
- public CompositionEntityValidationData updateNic(NicEntity nic, String user) {
+ public CompositionEntityValidationData updateNic(NicEntity nic) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, component id", nic.getVspId(), nic.getComponentId(),
nic.getId());
NicEntity retrieved =
- getNic(nic.getVspId(), nic.getVersion(), nic.getComponentId(), nic.getId());
+ getValidatedNic(nic.getVspId(), nic.getVersion(), nic.getComponentId(), nic.getId());
NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput();
schemaInput.setManual(vspInfoDao.isManual(nic.getVspId(), nic.getVersion()));
@@ -289,9 +284,6 @@ public class NicManagerImpl implements NicManager {
if (CollectionUtils.isEmpty(validationData.getErrors())) {
nicDao.update(nic);
}
-
- //nicDao.updateVspLatestModificationTime(nic.getVspId(), nic.getVersion());
-
mdcDataDebugMessage
.debugExitMessage("VSP id, component id", nic.getVspId(), nic.getComponentId(),
nic.getId());
@@ -301,7 +293,7 @@ public class NicManagerImpl implements NicManager {
@Override
public QuestionnaireResponse getNicQuestionnaire(String vspId, Version version,
- String componentId, String nicId, String user) {
+ String componentId, String nicId) {
mdcDataDebugMessage
.debugEntryMessage("VSP id, component id", vspId, componentId, nicId);
@@ -321,15 +313,13 @@ public class NicManagerImpl implements NicManager {
@Override
public void updateNicQuestionnaire(String vspId, Version version, String componentId,
- String nicId, String questionnaireData, String user) {
+ String nicId, String questionnaireData) {
mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId, nicId);
getNic(vspId, version, componentId, nicId);
nicDao.updateQuestionnaireData(vspId, version, componentId, nicId, questionnaireData);
- //nicDao.updateVspLatestModificationTime(vspId, version);
-
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId, nicId);
}
@@ -342,9 +332,4 @@ public class NicManagerImpl implements NicManager {
return SchemaGenerator
.generate(SchemaTemplateContext.composition, CompositionEntityType.nic, schemaInput);
}
- // todo *************************** move to reusable place! *************************
-
- /*private boolean isManual(String vspId, Version version) {
- return false;
- }*/
}
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 b5464e5708..b8fddcd075 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
@@ -20,40 +20,21 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-import org.openecomp.core.model.dao.ServiceModelDaoFactory;
-import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
import org.openecomp.sdc.healing.factory.HealingManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
public class OrchestrationTemplateCandidateManagerFactoryImpl extends
OrchestrationTemplateCandidateManagerFactory {
+
private static final OrchestrationTemplateCandidateManager INSTANCE =
new OrchestrationTemplateCandidateManagerImpl(
- VendorSoftwareProductDaoFactory.getInstance().createInterface(),
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- OrchestrationTemplateDaoFactory.getInstance().createInterface(),
CandidateServiceFactory.getInstance().createInterface(),
- HealingManagerFactory.getInstance().createInterface(),
- CompositionDataExtractorFactory.getInstance().createInterface(),
- ServiceModelDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface(),
- NicDaoFactory.getInstance().createInterface(),
- ComponentDaoFactory.getInstance().createInterface(),
- MonitoringUploadDaoFactory.getInstance().createInterface(),
- ProcessDaoFactory.getInstance().createInterface(),
- ActivityLogManagerFactory.getInstance().createInterface());
-
+ HealingManagerFactory.getInstance().createInterface()
+ );
@Override
public OrchestrationTemplateCandidateManager createInterface() {
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 07a3fa7f2c..f613dbb54f 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
@@ -23,11 +23,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
-import org.openecomp.core.model.dao.ServiceModelDao;
-import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
-import org.openecomp.sdc.activityLog.ActivityLogManager;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.common.utils.CommonUtil;
@@ -35,7 +32,6 @@ import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.healing.api.HealingManager;
-import org.openecomp.sdc.healing.types.HealCode;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.api.annotations.Metrics;
@@ -43,14 +39,7 @@ import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.messages.AuditMessages;
import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
-import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
@@ -58,9 +47,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.OrchestrationTemplateNotFo
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationTemplateFileHandler;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUploadFactory;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationProcessFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationTemplateProcessHandler;
-import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
-import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
@@ -80,114 +66,52 @@ public class OrchestrationTemplateCandidateManagerImpl
private static final Logger logger =
LoggerFactory.getLogger(OrchestrationTemplateCandidateManagerImpl.class);
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
- private VendorSoftwareProductDao vendorSoftwareProductDao;
+
private VendorSoftwareProductInfoDao vspInfoDao;
- private OrchestrationTemplateDao orchestrationTemplateDataDao;
private CandidateService candidateService;
private HealingManager healingManager;
- private CompositionDataExtractor compositionDataExtractor;
- private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao;
- private CompositionEntityDataManager compositionEntityDataManager;
- private NicDao nicDao;
- private ComponentDao componentDao;
- private ComponentArtifactDao componentArtifactDao;
- private ActivityLogManager activityLogManager;
- private ProcessDao processDao;
-
- /**
- * Instantiates a new Orchestration template candidate manager.
- *
- * @param vendorSoftwareProductDao the vendor software product dao
- * @param vspInfoDao the vsp info dao
- * @param orchestrationTemplateDataDao the orchestration template data dao
- * @param candidateService the candidate service
- * @param healingManager the healing manager
- * @param compositionDataExtractor the composition data extractor
- * @param serviceModelDao the service model dao
- * @param compositionEntityDataManager the composition entity data manager
- * @param nicDao the nic dao
- * @param componentDao the component dao
- * @param componentArtifactDao the mib dao
- * @param processDao the process dao
- * @param activityLogManager the activity log manager
- */
- public OrchestrationTemplateCandidateManagerImpl(
- VendorSoftwareProductDao vendorSoftwareProductDao, VendorSoftwareProductInfoDao
- vspInfoDao,
- OrchestrationTemplateDao orchestrationTemplateDataDao,
- CandidateService candidateService, HealingManager healingManager,
- CompositionDataExtractor compositionDataExtractor,
- ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao,
- CompositionEntityDataManager compositionEntityDataManager,
- NicDao nicDao,
- ComponentDao componentDao,
- ComponentArtifactDao componentArtifactDao,
- ProcessDao processDao,
- ActivityLogManager activityLogManager) {
- this.vendorSoftwareProductDao = vendorSoftwareProductDao;
+
+ public OrchestrationTemplateCandidateManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
+ CandidateService candidateService,
+ HealingManager healingManager) {
this.vspInfoDao = vspInfoDao;
- this.orchestrationTemplateDataDao = orchestrationTemplateDataDao;
this.candidateService = candidateService;
this.healingManager = healingManager;
- this.compositionDataExtractor = compositionDataExtractor;
- this.serviceModelDao = serviceModelDao;
- this.compositionEntityDataManager = compositionEntityDataManager;
- this.nicDao = nicDao;
- this.componentDao = componentDao;
- this.componentArtifactDao = componentArtifactDao;
- this.processDao = processDao;
- this.activityLogManager = activityLogManager;
}
@Override
@Metrics
public UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload,
- String user, String filePrefix,
- String networkPackageName) {
+ String fileSuffix, String networkPackageName) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+
OrchestrationTemplateFileHandler orchestrationTemplateFileHandler =
- OrchestrationUploadFactory.createOrchestrationTemplateFileHandler(filePrefix);
+ OrchestrationUploadFactory.createOrchestrationTemplateFileHandler(fileSuffix);
+
VspDetails vspDetails = getVspDetails(vspId, version);
+
UploadFileResponse uploadResponse = orchestrationTemplateFileHandler
- .upload(vspId, version, fileToUpload, user, candidateService,
- vspDetails);
- vspDetails.setOnboardingOrigin(filePrefix);
- vspDetails.setNetworkPackageName(networkPackageName);
- vspInfoDao.update(vspDetails);
+ .upload(vspDetails, fileToUpload, fileSuffix, networkPackageName, candidateService);
uploadResponse.setNetworkPackageName(networkPackageName);
return uploadResponse;
}
-
-
@Override
- public OrchestrationTemplateActionResponse process(String vspId,
- Version version, String user) {
+ public OrchestrationTemplateActionResponse process(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
- OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
-
- Optional<OrchestrationTemplateCandidateData> candidate =
- fetchCandidateDataEntity(vspId, version);
- if (!candidate.isPresent()) {
- throw new CoreException(new OrchestrationTemplateNotFoundErrorBuilder(vspId).build());
- }
- VspDetails vspDetails =
- getVspDetails(vspId, version);
- Optional<OrchestrationTemplateProcessHandler> processInstance =
- OrchestrationProcessFactory.getInstance(vspDetails.getOnboardingOrigin());
+ OrchestrationTemplateCandidateData candidate = fetchCandidateDataEntity(vspId, version)
+ .orElseThrow(
+ () -> new CoreException(new OrchestrationTemplateNotFoundErrorBuilder(vspId).build()));
- if(processInstance.isPresent()){
- response = processInstance.get().process(vspDetails, candidate.get(), user);
- }
-
- return response;
+ 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, String user) {
+ public Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
Optional<FilesDataStructure> candidateFileDataStructure =
@@ -195,19 +119,13 @@ public class OrchestrationTemplateCandidateManagerImpl
if (candidateFileDataStructure.isPresent()) {
return candidateFileDataStructure;
} else {
- Map<String, Object> healingParams = getHealingParamsAsMap(vspId, version, user);
-
- mdcDataDebugMessage
- .debugExitMessage("VSP id", vspId);
- return (Optional<FilesDataStructure>) healingManager
- .heal(HealCode.FILE_DATA_STRUCTURE_HEALER, healingParams);
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return Optional.empty();
}
}
@Override
-
- public ValidationResponse updateFilesDataStructure(String vspId,
- Version version, String user,
+ public ValidationResponse updateFilesDataStructure(String vspId, Version version,
FilesDataStructure fileDataStructure) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
@@ -222,27 +140,23 @@ public class OrchestrationTemplateCandidateManagerImpl
response.setUploadDataErrors(errorsMap, LoggerServiceName.Update_Manifest,
LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE);
- mdcDataDebugMessage
- .debugExitMessage("VSP id", vspId);
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return response;
}
}
- candidateService.updateOrchestrationTemplateCandidateFileDataStructure(vspId, version,
- fileDataStructure);
+ candidateService
+ .updateOrchestrationTemplateCandidateFileDataStructure(vspId, version, fileDataStructure);
- mdcDataDebugMessage
- .debugExitMessage("VSP id", vspId);
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return response;
}
@Override
- public Optional<Pair<String, byte[]>> get(String vspId, Version version, String user)
- throws IOException {
+ public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
- VspDetails vspDetails =
- getVspDetails(vspId, version);
+ VspDetails vspDetails = getVspDetails(vspId, version);
Optional<OrchestrationTemplateCandidateData> candidateDataEntity =
fetchCandidateDataEntity(vspId, version);
@@ -252,31 +166,34 @@ public class OrchestrationTemplateCandidateManagerImpl
Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage());
logger.error(errorMessage.getMessage());
- mdcDataDebugMessage
- .debugExitMessage("VSP id", vspId);
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return Optional.empty();
}
OnboardingTypesEnum type =
- OnboardingTypesEnum.getOnboardingTypesEnum(vspDetails.getOnboardingOrigin());
+ OnboardingTypesEnum.getOnboardingTypesEnum(candidateDataEntity.get().getFileSuffix());
- if(CommonUtil.isFileOriginFromZip(vspDetails.getOnboardingOrigin())) {
+ if (CommonUtil.isFileOriginFromZip(candidateDataEntity.get().getFileSuffix())) {
FilesDataStructure structure = JsonUtil
.json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
String manifest = candidateService.createManifest(vspDetails, structure);
- mdcDataDebugMessage
- .debugExitMessage("VSP id", vspId);
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return Optional.of(
- new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(),candidateService
+ new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(), candidateService
.replaceManifestInZip(candidateDataEntity.get().getContentData(),
- manifest, vspId, type)));
+ manifest, vspId, type)));
}
return Optional.of(
- new ImmutablePair<>(vspDetails.getOnboardingOrigin(),candidateDataEntity.get()
+ new ImmutablePair<>(candidateDataEntity.get().getFileSuffix(), candidateDataEntity.get()
.getContentData().array()));
}
+ @Override
+ public OrchestrationTemplateCandidateData getInfo(String vspId, Version version) {
+ return candidateService.getOrchestrationTemplateCandidateInfo(vspId, version);
+ }
+
private Optional<OrchestrationTemplateCandidateData> fetchCandidateDataEntity(
String vspId, Version version) {
return Optional
@@ -286,19 +203,22 @@ public class OrchestrationTemplateCandidateManagerImpl
// todo *************************** move to reusable place! *************************
- private Map<String, Object> getHealingParamsAsMap(String vspId, Version version, String user) {
+ private Map<String, Object> getHealingParamsAsMap(String vspId, Version version) {
Map<String, Object> healingParams = new HashMap<>();
healingParams.put(SdcCommon.VSP_ID, vspId);
healingParams.put(SdcCommon.VERSION, version);
- healingParams.put(SdcCommon.USER, user);
return healingParams;
}
private VspDetails getVspDetails(String vspId, Version version) {
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
- vspDetails.setValidationData(orchestrationTemplateDataDao.getValidationData(vspId, version));
+/* OrchestrationTemplateEntity orchestrationTemplateInfo =
+ orchestrationTemplateDao.getInfo(vspId, version);
+ vspDetails.setValidationData(orchestrationTemplateInfo.getValidationData());
+ vspDetails.setNetworkPackageName(orchestrationTemplateInfo.getFileName());
+ vspDetails.setOnboardingOrigin(orchestrationTemplateInfo.getFileSuffix());*/
return vspDetails;
}
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 d870454de7..7a4e4876d2 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
@@ -20,16 +20,13 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.ProcessManager;
import org.openecomp.sdc.vendorsoftwareproduct.ProcessManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
public class ProcessManagerFactoryImpl extends ProcessManagerFactory {
private static final ProcessManager INSTANCE =
- new ProcessManagerImpl(
- VendorSoftwareProductDaoFactory.getInstance().createInterface(),
- ActivityLogManagerFactory.getInstance().createInterface());
+ new ProcessManagerImpl(ProcessDaoFactory.getInstance().createInterface());
@Override
public ProcessManager createInterface() {
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 a3d0286019..121abda1ee 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
@@ -22,12 +22,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
@@ -35,138 +33,133 @@ import org.openecomp.sdc.logging.types.LoggerErrorCode;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.ProcessManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.UploadInvalidErrorBuilder;
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdcrests.activitylog.types.ActivityType;
+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 MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
- private final ActivityLogManager activityLogManager;
+ 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 VendorSoftwareProductDao vendorSoftwareProductDao;
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+ private ProcessDao processDao;
- public ProcessManagerImpl(VendorSoftwareProductDao vendorSoftwareProductDao, ActivityLogManager activityLogManager) {
- this.vendorSoftwareProductDao = vendorSoftwareProductDao;
- this.activityLogManager = activityLogManager;
+ public ProcessManagerImpl(ProcessDao processDao) {
+ this.processDao = processDao;
}
@Override
public Collection<ProcessEntity> listProcesses(String vspId, Version version,
- String componentId,
- String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
+ String componentId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
- return vendorSoftwareProductDao.listProcesses(vspId, version, componentId);
+ return processDao.list(new ProcessEntity(vspId, version, componentId, null));
}
@Override
- public void deleteProcesses(String vspId, Version version, String componentId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+ public void deleteProcesses(String vspId, Version version, String componentId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- Collection<ProcessEntity> processes =
- vendorSoftwareProductDao.listProcesses(vspId, version, 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());
}
+ }
- vendorSoftwareProductDao.deleteProcesses(vspId, version, componentId);
+ if (componentId == null) {
+ processDao.deleteVspAll(vspId,version);
+ } else {
+ processDao.deleteAll(allProcesses);
}
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
+
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
}
@Override
- public ProcessEntity createProcess(ProcessEntity process, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", process.getId(),
+ public ProcessEntity createProcess(ProcessEntity process) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", process.getId(),
process.getComponentId());
validateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
process.getName());
- //process.setId(CommonMethods.nextUuId());
- vendorSoftwareProductDao.createProcess(process);
+ processDao.create(process);
createUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
process.getName());
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", process.getId(),
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", process.getId(),
process.getComponentId());
return process;
}
-
@Override
public ProcessEntity getProcess(String vspId, Version version, String componentId,
- String processId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+ String processId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
ProcessEntity retrieved =
- vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId);
+ processDao.get(new ProcessEntity(vspId, version, componentId, processId));
validateProcessExistence(vspId, version, componentId, processId, retrieved);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
return retrieved;
}
@Override
- public void updateProcess(ProcessEntity process, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", process.getId(),
+ public void updateProcess(ProcessEntity process) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", process.getId(),
process.getComponentId());
- ProcessEntity retrieved = vendorSoftwareProductDao
- .getProcess(process.getVspId(), process.getVersion(), process.getComponentId(),
- process.getId());
+ 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());
- vendorSoftwareProductDao.updateProcess(process);
+ processDao.update(process);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", process.getId(),
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", process.getId(),
process.getComponentId());
}
@Override
- public void deleteProcess(String vspId, Version version, String componentId, String processId,
- String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+ public void deleteProcess(String vspId, Version version, String componentId, String processId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- ProcessEntity retrieved =
- vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId);
- validateProcessExistence(vspId, version, componentId, processId, retrieved);
+ ProcessEntity retrieved = getProcess(vspId, version, componentId, processId);
- vendorSoftwareProductDao.deleteProcess(vspId, version, componentId, processId);
+ processDao.delete(retrieved);
deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
retrieved.getName());
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
}
@Override
public File getProcessArtifact(String vspId, Version version, String componentId,
- String processId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+ String processId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- ProcessEntity retrieved =
- vendorSoftwareProductDao.getProcessArtifact(vspId, version, componentId, processId);
- validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved);
+ 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)) {
@@ -175,125 +168,115 @@ public class ProcessManagerImpl implements ProcessManager {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.GET_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get process artifact");
- throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
+ throw new CoreException(new UploadInvalidErrorBuilder().build());
}
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
return file;
}
@Override
public void deleteProcessArtifact(String vspId, Version version, String componentId,
- String processId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+ String processId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
- ProcessEntity retrieved =
- vendorSoftwareProductDao.getProcessArtifact(vspId, version, componentId, processId);
- validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved);
+ ProcessEntity retrieved = getValidatedProcessArtifact(vspId, version, componentId, processId);
- vendorSoftwareProductDao.deleteProcessArtifact(vspId, version, componentId, processId);
+ processDao.deleteArtifact(retrieved);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
}
@Override
public void uploadProcessArtifact(InputStream artifactFile, String artifactFileName, String vspId,
- Version version, String componentId, String processId,
- String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+ Version version, String componentId, String processId) {
+ mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+
+ ProcessEntity process = getProcess(vspId, version, componentId, processId);
+ process.setArtifactName(artifactFileName);
+ process.setArtifact(readArtifact(artifactFile));
+ processDao.uploadArtifact(process);
+ mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+ }
+
+ private ProcessEntity getValidatedProcessArtifact(String vspId, Version version,
+ String componentId, String processId) {
ProcessEntity retrieved =
- vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId);
- validateProcessExistence(vspId, version, componentId, processId, retrieved);
+ processDao.getArtifact(new ProcessEntity(vspId, version, componentId, processId));
+ validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved);
+ return retrieved;
+ }
- if (artifactFile == null) {
+ private ByteBuffer readArtifact(InputStream artifactInputStream) {
+ if (artifactInputStream == null) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.UPLOAD_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't upload process artifact");
throw new CoreException(new UploadInvalidErrorBuilder().build());
}
-
- byte[] artifact;
try {
- artifact = FileUtils.toByteArray(artifactFile);
+ return ByteBuffer.wrap(FileUtils.toByteArray(artifactInputStream));
} catch (RuntimeException exception) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.UPLOAD_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't upload process artifact");
- throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
+ throw new CoreException(new UploadInvalidErrorBuilder().build());
}
-
- vendorSoftwareProductDao.uploadProcessArtifact(vspId, version, componentId, processId, artifact,
- artifactFileName);
- ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspId, String.valueOf(version.getMajor()+1),
- ActivityType.UPLOAD_MONITORING_FILE.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
}
private void validateProcessExistence(String vspId, Version version, String componentId,
String processId, ProcessEntity retrieved) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id, process id", vspId, componentId,
- processId);
-
- if (retrieved != null) {
- return;
- }
VersioningUtil.validateEntityExistence(retrieved,
new ProcessEntity(vspId, version, componentId, processId),
- VspDetails.ENTITY_TYPE);//todo retrieved is always null ??
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id, process id", vspId, componentId,
- processId);
+ VspDetails.ENTITY_TYPE);
}
private void validateProcessArtifactExistence(String vspId, Version version, String componentId,
String processId, ProcessEntity retrieved) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id, process id", vspId, componentId,
- processId);
-
- if (retrieved != null) {
- VersioningUtil.validateEntityExistence(retrieved.getArtifact(),
- new ProcessEntity(vspId, version, componentId, processId),
- VspDetails.ENTITY_TYPE);
- } else {
- VersioningUtil.validateEntityExistence(retrieved,
- new ProcessEntity(vspId, version, componentId, processId),
- VspDetails.ENTITY_TYPE); //todo retrieved is always null ??
+ 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()
+ .withCategory(ErrorCategory.APPLICATION)
+ .withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND)
+ .withMessage(String.format(PROCESS_ARTIFACT_NOT_EXIST_MSG,
+ processId, VspDetails.ENTITY_TYPE, vspId, version)).build());
}
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id, process id", vspId, componentId,
- processId);
}
protected void validateUniqueName(String vspId, Version version, String componentId,
String processName) {
UniqueValueUtil.validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME,
- vspId, version.toString(), componentId, processName);
+ vspId, version.getId(), componentId, processName);
}
protected void createUniqueName(String vspId, Version version, String componentId,
String processName) {
UniqueValueUtil
.createUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, vspId,
- version.toString(), componentId, processName);
+ 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.toString(), componentId);
+ 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.toString(), componentId, processName);
+ 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 d4879da8d7..640d5c00c7 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
@@ -34,18 +34,12 @@ import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.core.validation.api.ValidationManager;
import org.openecomp.core.validation.util.MessageContainerUtil;
-import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
import org.openecomp.sdc.common.utils.CommonUtil;
-import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
-import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
@@ -63,11 +57,14 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsSe
import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.VendorSoftwareProductNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
@@ -76,18 +73,17 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
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.dao.type.OnboardingMethod;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.CreatePackageForNonFinalVendorSoftwareProductErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.DeploymentFlavorErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.FileCreationErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.InformationArtifactCreationErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.NicInternalNetworkErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.OnboardingMethodErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageInvalidErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder;
@@ -99,7 +95,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGe
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
@@ -111,15 +106,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQu
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
import org.openecomp.sdc.vendorsoftwareproduct.utils.ComponentDependencyTracker;
-import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdcrests.activitylog.types.ActivityType;
-import org.slf4j.MDC;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
@@ -136,276 +124,178 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager {
- private String VALIDATION_VSP_ID = "validationOnlyVspId";
- private static final String VALIDATION_VSP_NAME = "validationOnlyVspName";
- //private static final String VALIDATION_VSP_USER = "validationOnlyVspUser";
-
- private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
+ private static MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
private static final Logger LOGGER =
LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
- private final OrchestrationTemplateDao orchestrationTemplateDao;
- private final VendorSoftwareProductInfoDao vspInfoDao;
- private final VersioningManager versioningManager;
- private final VendorSoftwareProductDao vendorSoftwareProductDao;
- private final VendorLicenseFacade vendorLicenseFacade;
- private final ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao;
- private final EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao;
- private final HealingManager healingManager;
- private final VendorLicenseArtifactsService licenseArtifactsService;
- private final InformationArtifactGenerator informationArtifactGenerator;
- private final PackageInfoDao packageInfoDao;
- private final ActivityLogManager activityLogManager;
- private final DeploymentFlavorDao deploymentFlavorDao;
- private final NicDao nicDao;
- private final ManualVspToscaManager manualVspToscaManager;
-
- /**
- * Instantiates a new Vendor software product manager.
- *
- * @param versioningManager the versioning manager
- * @param vendorSoftwareProductDao the vendor software product dao
- * @param orchestrationTemplateDataDao the orchestration template data dao
- * @param vspInfoDao the vsp info dao
- * @param vendorLicenseFacade the vendor license facade
- * @param serviceModelDao the service model dao
- * @param enrichedServiceModelDao the enriched service model dao
- * @param healingManager the healing manager
- * @param licenseArtifactsService the license artifacts service
- * @param informationArtifactGenerator the information artifact generator
- * @param packageInfoDao the package info dao
- * @param activityLogManager the activity log manager
- * @param deploymentFlavorDao the deployment flavor dao
- * @param nicDao the nic dao
- */
+ private OrchestrationTemplateDao orchestrationTemplateDao;
+ private VendorSoftwareProductInfoDao vspInfoDao;
+ private VendorLicenseFacade vendorLicenseFacade;
+ private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao;
+ private EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao;
+ private VendorLicenseArtifactsService licenseArtifactsService;
+ private InformationArtifactGenerator informationArtifactGenerator;
+ private PackageInfoDao packageInfoDao;
+ private DeploymentFlavorDao deploymentFlavorDao;
+ private ComponentDao componentDao;
+ private ComponentDependencyModelDao componentDependencyModelDao;
+ private NicDao nicDao;
+ private ComputeDao computeDao;
+ private ImageDao imageDao;
+ private ManualVspToscaManager manualVspToscaManager;
+
public VendorSoftwareProductManagerImpl(
- VersioningManager versioningManager,
- VendorSoftwareProductDao vendorSoftwareProductDao,
OrchestrationTemplateDao orchestrationTemplateDataDao,
VendorSoftwareProductInfoDao vspInfoDao,
VendorLicenseFacade vendorLicenseFacade,
ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao,
EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao,
- HealingManager healingManager,
VendorLicenseArtifactsService licenseArtifactsService,
InformationArtifactGenerator informationArtifactGenerator,
PackageInfoDao packageInfoDao,
- ActivityLogManager activityLogManager,
DeploymentFlavorDao deploymentFlavorDao,
+ ComponentDao componentDao,
+ ComponentDependencyModelDao componentDependencyModelDao,
NicDao nicDao,
+ ComputeDao computeDao,
+ ImageDao imageDao,
ManualVspToscaManager manualVspToscaManager) {
- this.versioningManager = versioningManager;
- this.vendorSoftwareProductDao = vendorSoftwareProductDao;
this.orchestrationTemplateDao = orchestrationTemplateDataDao;
this.vspInfoDao = vspInfoDao;
this.vendorLicenseFacade = vendorLicenseFacade;
this.serviceModelDao = serviceModelDao;
this.enrichedServiceModelDao = enrichedServiceModelDao;
- this.healingManager = healingManager;
this.licenseArtifactsService = licenseArtifactsService;
this.informationArtifactGenerator = informationArtifactGenerator;
this.packageInfoDao = packageInfoDao;
- this.activityLogManager = activityLogManager;
this.deploymentFlavorDao = deploymentFlavorDao;
+ this.componentDao = componentDao;
+ this.componentDependencyModelDao = componentDependencyModelDao;
this.nicDao = nicDao;
+ this.computeDao = computeDao;
+ this.imageDao = imageDao;
this.manualVspToscaManager = manualVspToscaManager;
registerToVersioning();
}
private void registerToVersioning() {
- vendorSoftwareProductDao.registerVersioning(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
serviceModelDao.registerVersioning(
VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
enrichedServiceModelDao.registerVersioning(
VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE);
}
- @Override
- public Version checkout(String vendorSoftwareProductId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vendorSoftwareProductId);
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkout_Entity.toString());
-
- Version newVersion = versioningManager
- .checkout(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vendorSoftwareProductId, user);
-
- if (newVersion != null) {
- ActivityLogEntity activityLogEntity =
- new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(newVersion.getMajor() + 1),
- ActivityType.CHECKOUT.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
- }
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vendorSoftwareProductId);
- return newVersion;
- }
-
-
- @Override
- public Version undoCheckout(String vendorSoftwareProductId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vendorSoftwareProductId);
-
- Version version =
- getVersionInfo(vendorSoftwareProductId, VersionableEntityAction.Read, user)
- .getActiveVersion();
-
- ActivityLogEntity activityLogEntity =
- new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(version.getMajor() + 1),
- ActivityType.UNDO_CHECKOUT.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
-
- String preVspName = vspInfoDao
- .get(new VspDetails(vendorSoftwareProductId, version)).getName();
-
- Version newVersion = versioningManager.undoCheckout(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vendorSoftwareProductId, user);
-
- String postVspName = vspInfoDao
- .get(new VspDetails(vendorSoftwareProductId, newVersion))
- .getName();
-
- updateUniqueName(preVspName, postVspName);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vendorSoftwareProductId);
-
- return newVersion;
- }
@Override
- public Version checkin(String vendorSoftwareProductId, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vendorSoftwareProductId);
-
- Version newVersion = versioningManager.checkin(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vendorSoftwareProductId, user, null);
-
- if (newVersion != null) {
- ActivityLogEntity activityLogEntity =
- new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(newVersion.getMajor() + 1),
- ActivityType.CHECKIN.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
- }
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vendorSoftwareProductId);
-
- return newVersion;
- }
-
- @Override
- public ValidationResponse submit(String vspId, String user) throws IOException {
+ public ValidationResponse validate(String vspId, Version version) throws IOException {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
- Version version = getVersionInfo(vspId, VersionableEntityAction.Read, user).getActiveVersion();
- VspDetails vspDetails = getVsp(vspId, version, user);
- UploadDataEntity uploadData = orchestrationTemplateDao.getOrchestrationTemplate(vspId, version);
- ToscaServiceModel serviceModel =
- serviceModelDao.getServiceModel(vspId, vspDetails.getVersion());
+ VspDetails vspDetails = getValidatedVsp(vspId, version);
+ Collection<ComponentDependencyModelEntity> componentDependencies =
+ componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null));
ValidationResponse validationResponse = new ValidationResponse();
- validationResponse
- .setVspErrors(validateCompletedVendorSoftwareProduct(vspDetails, uploadData, serviceModel),
- LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP);
-
- if (isCyclicDependencyInComponents(vspId, vspDetails.getVersion())) {
- Collection<ErrorCode> vspErrors = validationResponse.getVspErrors() == null
- ? new ArrayList<>()
- : validationResponse.getVspErrors();
- vspErrors.add(ComponentDependencyModelErrorBuilder
- .getcyclicDependencyComponentErrorBuilder());
- validationResponse.setVspErrors(vspErrors, LoggerServiceName.Submit_VSP,
- LoggerTragetServiceName.SUBMIT_VSP);
- }
-
- validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails));
- validationResponse
- .setUploadDataErrors(validateUploadData(uploadData, vspDetails),
- LoggerServiceName.Submit_VSP,
- LoggerTragetServiceName.SUBMIT_VSP);
-
validationResponse.setQuestionnaireValidationResult(
- validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails
- .getOnboardingMethod()));
-
- if ("Manual".equals(vspDetails.getOnboardingMethod())) {
- Collection<ErrorCode> deploymentFlavourValidationErrList =
- deploymentFlavorValidation(vspDetails.getId(), vspDetails.getVersion());
- if (validationResponse.getVspErrors() != null) {
- if (deploymentFlavourValidationErrList != null) {
- validationResponse.getVspErrors().addAll(deploymentFlavourValidationErrList);
- }
- } else {
- validationResponse
- .setVspErrors(deploymentFlavourValidationErrList, LoggerServiceName.Submit_VSP,
- LoggerTragetServiceName.SUBMIT_VSP);
+ validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(),
+ vspDetails.getOnboardingMethod()));
+
+ List<ErrorCode> vspErrors = new ArrayList<>();
+ vspErrors.addAll(validateVspFields(vspDetails));
+ if (validateComponentDependencies(componentDependencies)) {
+ vspErrors
+ .add(ComponentDependencyModelErrorBuilder.getcyclicDependencyComponentErrorBuilder());
+ }
+ if (Objects.nonNull(vspDetails.getOnboardingMethod()) &&
+ OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod())) {
+ vspErrors.addAll(validateMandatoryLicenseFields(vspDetails));
+
+ Collection<DeploymentFlavorEntity> deploymentFlavors = deploymentFlavorDao
+ .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails.getVersion(), null));
+ if (CollectionUtils.isEmpty(deploymentFlavors)) {
+ vspErrors
+ .add(VendorSoftwareProductInvalidErrorBuilder.VspMissingDeploymentFlavorErrorBuilder());
}
+ vspErrors.addAll(validateDeploymentFlavors(deploymentFlavors));
- Set<CompositionEntityValidationData> compositionEntityValidationData =
+ Set<CompositionEntityValidationData> componentValidationResult =
componentValidation(vspDetails.getId(), vspDetails.getVersion());
- if (validationResponse.getQuestionnaireValidationResult() != null) {
- if (!CollectionUtils.isEmpty(compositionEntityValidationData)) {
+ if (!CollectionUtils.isEmpty(componentValidationResult)) {
+ if (validationResponse.getQuestionnaireValidationResult() == null ||
+ validationResponse.getQuestionnaireValidationResult().getValidationData() == null) {
+ validationResponse.setQuestionnaireValidationResult(
+ new QuestionnaireValidationResult(componentValidationResult));
+ } else {
validationResponse.getQuestionnaireValidationResult().getValidationData()
- .addAll(compositionEntityValidationData);
+ .addAll(componentValidationResult);
}
- } else {
- validationResponse.setQuestionnaireValidationResult(
- CollectionUtils.isEmpty(compositionEntityValidationData) ? null :
- new QuestionnaireValidationResult(compositionEntityValidationData));
}
-
- //Generate Tosca service model for Manual Onboarding flow
- VspModelInfo vspModelInfo = manualVspToscaManager.gatherVspInformation(vspId, version, user);
- serviceModel = manualVspToscaManager.generateToscaModel(vspModelInfo);
- }
- validationResponse.setCompilationErrors(
- compile(vspId, vspDetails.getVersion(), serviceModel),
- LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP);
-
- if (validationResponse.isValid()) {
- Version newVersion = versioningManager.submit(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vspId, user, null);
- ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspDetails.getId(), String
- .valueOf(newVersion.getMajor()),
- ActivityType.SUBMIT.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
+ } else {
+ if (vspDetails.getVlmVersion() != null || vspDetails.getLicenseAgreement() != null
+ || vspDetails.getFeatureGroups() != null) {
+ vspErrors.addAll(validateMandatoryLicenseFields(vspDetails));
+ }
+ OrchestrationTemplateEntity orchestrationTemplate =
+ orchestrationTemplateDao.get(vspId, version);
+ ToscaServiceModel serviceModel =
+ serviceModelDao.getServiceModel(vspId, vspDetails.getVersion());
+ if (!isOrchestrationTemplateExist(orchestrationTemplate) ||
+ !isServiceModelExist(serviceModel)) {
+ vspErrors.add(VendorSoftwareProductInvalidErrorBuilder
+ .VendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(),
+ vspDetails.getVersion()));
+ }
+ validationResponse.setUploadDataErrors(validateOrchestrationTemplate(orchestrationTemplate),
+ LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP);
}
+ validationResponse
+ .setVspErrors(vspErrors, LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP);
+ validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails));
+
MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
return validationResponse;
}
- private boolean isCyclicDependencyInComponents(String vendorSoftwareProductId,
- Version version) {
- final Collection<ComponentDependencyModelEntity> componentDependencyModelEntities =
- vendorSoftwareProductDao.listComponentDependencies(vendorSoftwareProductId, version);
+ @Override
+ public Map<String, List<ErrorMessage>> compile(String vspId, Version version) {
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
+
+ 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);
+
+ Map<String, List<ErrorMessage>> compilationErrors = compile(vspId, version, serviceModel);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
+ return compilationErrors;
+ }
+
+ private boolean validateComponentDependencies(
+ Collection<ComponentDependencyModelEntity> componentDependencies) {
ComponentDependencyTracker dependencyTracker = new ComponentDependencyTracker();
- for (ComponentDependencyModelEntity entity : componentDependencyModelEntities) {
- dependencyTracker.addDependency(entity.getSourceComponentId(), entity.getTargetComponentId());
+ for (ComponentDependencyModelEntity componentDependency : componentDependencies) {
+ dependencyTracker.addDependency(componentDependency.getSourceComponentId(),
+ componentDependency.getTargetComponentId());
}
return dependencyTracker.isCyclicDependencyPresent();
}
- private Collection<ErrorCode> deploymentFlavorValidation(String vspId,
- Version version) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
- Set<CompositionEntityValidationData> validationData = new HashSet<>();
+ private Collection<ErrorCode> validateDeploymentFlavors(
+ Collection<DeploymentFlavorEntity> deploymentFlavors) {
+
Collection<ErrorCode> errorCodeList = new ArrayList<>();
- Collection<DeploymentFlavorEntity> deploymentFlavors =
- vendorSoftwareProductDao.listDeploymentFlavors(vspId, version);
if (!CollectionUtils.isEmpty(deploymentFlavors)) {
deploymentFlavors.forEach(deploymentFlavor -> {
- DeploymentFlavorEntity deployment = vendorSoftwareProductDao.getDeploymentFlavor(vspId,
- version, deploymentFlavor.getId());
+ DeploymentFlavorEntity deployment = deploymentFlavorDao.get(deploymentFlavor);
DeploymentFlavor deploymentlocalFlavor = deployment.getDeploymentFlavorCompositionData();
if (deploymentlocalFlavor != null) {
if (deploymentlocalFlavor.getFeatureGroupId() == null) {
@@ -455,7 +345,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
Set<CompositionEntityValidationData> validationData = new HashSet<>();
Collection<ComponentEntity> components =
- vendorSoftwareProductDao.listComponents(vspId, version);
+ componentDao.list(new ComponentEntity(vspId, version, null));
if (!CollectionUtils.isEmpty(components)) {
components.forEach(component -> {
validateImage(vspId, version, validationData, component);
@@ -496,13 +386,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private void validateImage(String vspId, Version version,
Set<CompositionEntityValidationData> validationData,
ComponentEntity component) {
- Collection<ImageEntity> images = vendorSoftwareProductDao.listImages(vspId, version,
- component.getId());
+ 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.setEntityName(component.getComponentCompositionData()
- .getDisplayName());
+ compositionEntityValidationData
+ .setEntityName(component.getComponentCompositionData().getDisplayName());
ErrorCode vfcMissingImageErrorBuilder =
ComponentErrorBuilder.VfcMissingImageErrorBuilder();
List<String> errors = new ArrayList<>();
@@ -512,10 +402,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
}
-
- private List<ErrorCode> validateCompletedVendorSoftwareProduct(
- VspDetails vspDetails, UploadDataEntity uploadData, Object serviceModel) {
-
+ private List<ErrorCode> validateVspFields(VspDetails vspDetails) {
List<ErrorCode> errors = new ArrayList<>();
if (vspDetails.getName() == null) {
@@ -533,36 +420,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
if (vspDetails.getSubCategory() == null) {
errors.add(createMissingMandatoryFieldError("sub category"));
}
- if ("Manual".equals(vspDetails.getOnboardingMethod())) {
- //Manual Onboarding specific validations
- Collection<DeploymentFlavorEntity> deploymentFlavorEntities = vendorSoftwareProductDao
- .listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion());
- if (CollectionUtils.isEmpty(deploymentFlavorEntities)) {
- ErrorCode vspMissingDeploymentFlavorErrorBuilder =
- VendorSoftwareProductInvalidErrorBuilder.VspMissingDeploymentFlavorErrorBuilder();
- errors.add(vspMissingDeploymentFlavorErrorBuilder);
- }
- errors.addAll(validateMandatoryLicenseFields(vspDetails));
- } else {
- //Heat flow specific VSP validations
- if (uploadData == null || uploadData.getContentData() == null || serviceModel == null) {
- errors.add(VendorSoftwareProductInvalidErrorBuilder
- .VendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(),
- vspDetails.getVersion()));
- }
- if (vspDetails.getVlmVersion() != null || vspDetails.getLicenseAgreement() != null
- || vspDetails.getFeatureGroups() != null) {
- errors.addAll(validateMandatoryLicenseFields(vspDetails));
- }
- }
- return errors.isEmpty() ? null : errors;
+ return errors;
}
private List<ErrorCode> validateMandatoryLicenseFields(VspDetails vspDetails) {
List<ErrorCode> errors = new ArrayList<>();
if (vspDetails.getVlmVersion() == null) {
- errors.add(createMissingMandatoryFieldError(
- "licensing version (in the format of: {integer}.{integer})"));
+ errors.add(createMissingMandatoryFieldError("licensing version"));
}
if (vspDetails.getLicenseAgreement() == null) {
errors.add(createMissingMandatoryFieldError("license agreement"));
@@ -577,23 +441,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return new ValidationErrorBuilder("must be supplied", fieldName).build();
}
- String getVspQuestionnaireSchema(SchemaTemplateInput schemaInput) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
- return SchemaGenerator
- .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput);
- }
-
- private static void sortVspListByModificationTimeDescOrder(
- List<VersionedVendorSoftwareProductInfo> vsps) {
- vsps.sort((o1, o2) -> o2.getVspDetails().getWritetimeMicroSeconds()
- .compareTo(o1.getVspDetails().getWritetimeMicroSeconds()));
- }
-
-
private Map<String, List<ErrorMessage>> compile(String vendorSoftwareProductId, Version version,
ToscaServiceModel serviceModel) {
- if (serviceModel == null) {
+ if (!isServiceModelExist(serviceModel)) {
return null;
}
@@ -636,135 +486,47 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public String fetchValidationVsp(String user) {
- try {
- validateUniqueName(VALIDATION_VSP_NAME);
- } catch (Exception ignored) {
- LOGGER.debug("Ignored exception when validating unique VSP name", ignored);
- return VALIDATION_VSP_ID;
- }
- VspDetails validationVsp = new VspDetails();
- validationVsp.setName(VALIDATION_VSP_NAME);
-
- vspInfoDao.create(validationVsp);
- Version version = versioningManager.create(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- validationVsp.getId(), user);
- validationVsp.setVersion(version);
-
- createUniqueName(VALIDATION_VSP_NAME);
- VALIDATION_VSP_ID = validationVsp.getId();
- return VALIDATION_VSP_ID;
- }
-
- @Override
- public VspDetails createVsp(VspDetails vspDetails, String user) {
+ public VspDetails createVsp(VspDetails vspDetails) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
- validateUniqueName(vspDetails.getName());
-
- vspDetails.setOnboardingOrigin(OnboardingTypesEnum.NONE.toString());
-
- vspInfoDao.create(vspDetails);//id will be set in the dao
- vspInfoDao.updateQuestionnaireData(vspDetails.getId(), null,
+ vspInfoDao.create(vspDetails);
+ vspInfoDao.updateQuestionnaireData(vspDetails.getId(), vspDetails.getVersion(),
new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData());
- Version version = versioningManager
- .create(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vspDetails.getId(), user);
- vspDetails.setVersion(version);
- ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspDetails.getId(), String
- .valueOf(vspDetails.getVersion().getMajor() + 1),
- ActivityType.CREATE_NEW.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
- String vspName = vspDetails.getName();
- createUniqueName(vspName);
MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
return vspDetails;
}
@Override
- public List<VersionedVendorSoftwareProductInfo> listVsps(String versionFilter, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
-
- Map<String, VersionInfo> idToVersionsInfo = versioningManager.listEntitiesVersionInfo(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, user,
- VersionableEntityAction.Read);
-
- List<VersionedVendorSoftwareProductInfo> vsps = new ArrayList<>();
- for (Map.Entry<String, VersionInfo> entry : idToVersionsInfo.entrySet()) {
- VersionInfo versionInfo = entry.getValue();
- if (versionFilter != null && versionFilter.equals(VersionStatus.Final.name())) {
- if (versionInfo.getLatestFinalVersion() == null) {
- continue;
- }
- versionInfo.setActiveVersion(versionInfo.getLatestFinalVersion());
- versionInfo.setStatus(VersionStatus.Final);
- versionInfo.setLockingUser(null);
- }
-
- Version version = versionInfo.getActiveVersion();
- if (user.equals(versionInfo.getLockingUser())) {
- version.setStatus(VersionStatus.Locked);
- }
- try {
- VspDetails vsp = vspInfoDao.get(new VspDetails(entry.getKey(), version));
- if (vsp != null && !vsp.getId().equals(VALIDATION_VSP_ID)) {
- vsp.setValidationDataStructure(null);
- vsps.add(new VersionedVendorSoftwareProductInfo(vsp, versionInfo));
- }
- } catch (RuntimeException rte) {
- LOGGER.error(
- "Error trying to retrieve vsp[" + entry.getKey() + "] version[" + version.toString
- () + "] " +
- "message:" + rte.getMessage(), rte);
- }
- }
-
- sortVspListByModificationTimeDescOrder(vsps);
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
-
- return vsps;
- }
-
- @Override
- public void updateVsp(VspDetails vspDetails, String user) {
+ public void updateVsp(VspDetails vspDetails) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspDetails.getId());
VspDetails retrieved = vspInfoDao.get(vspDetails);
- if (!Objects.equals(retrieved.getOnboardingMethod(), vspDetails.getOnboardingMethod())) {
- final ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
- .getOnboardingUpdateError();
-
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.UPDATE_VSP, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message());
-
- throw new CoreException(onboardingMethodUpdateErrorCode);
+ // TODO: 6/21/2017 remove this validation when validation will be added in the REST level
+ if (retrieved == null) {
+ throw new RuntimeException(String.format("Vsp with id %s and version %s does not exist.",
+ vspDetails.getId(), vspDetails.getVersion().getId()));
}
+ 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, user);
+ updateDeploymentFlavor(vspDetails);
updateUniqueName(retrieved.getName(), vspDetails.getName());
- vspDetails.setOldVersion(retrieved.getOldVersion());
-
vspInfoDao.update(vspDetails);
- //vendorSoftwareProductDao.updateVspLatestModificationTime(vspDetails.getId(), activeVersion);
MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspDetails.getId());
}
- private void updateDeploymentFlavor(VspDetails vspDetails, String user) {
+ private void updateDeploymentFlavor(VspDetails vspDetails) {
final List<String> featureGroups = vspDetails.getFeatureGroups();
if (featureGroups != null) {
final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deploymentFlavorDao
.list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails
.getVersion(), null));
if (Objects.nonNull(deploymentFlavorEntities)) {
- deploymentFlavorEntities.forEach(deploymentFlavorEntity -> {
+ for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
final String featureGroupId =
deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId();
if (!featureGroups.contains(featureGroupId)) {
@@ -773,18 +535,25 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
deploymentFlavorCompositionData.setFeatureGroupId(null);
deploymentFlavorEntity.setDeploymentFlavorCompositionData
(deploymentFlavorCompositionData);
- vendorSoftwareProductDao.updateDeploymentFlavor(deploymentFlavorEntity);
+ deploymentFlavorDao.update(deploymentFlavorEntity);
}
- });
+ }
}
}
}
@Override
- public VspDetails getVsp(String vspId, Version version, String user) {
+ public VspDetails getVsp(String vspId, Version version) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
+ VspDetails vsp = getValidatedVsp(vspId, version);
+
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
+ return vsp;
+ }
+
+ private VspDetails getValidatedVsp(String vspId, Version version) {
VspDetails vsp = vspInfoDao.get(new VspDetails(vspId, version));
if (vsp == null) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -792,64 +561,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
LoggerErrorCode.DATA_ERROR.getErrorCode(), "Requested VSP not found");
throw new CoreException(new VendorSoftwareProductNotFoundErrorBuilder(vspId).build());
}
- vsp.setValidationData(orchestrationTemplateDao.getValidationData(vspId, version));
- if (Objects.isNull(vsp.getOnboardingOrigin())) { //todo should this only be done for non-Manual?
- vsp.setOnboardingOrigin(OnboardingTypesEnum.ZIP.toString());
- }
-
- if (Objects.isNull(vsp.getNetworkPackageName())) {
- vsp.setNetworkPackageName("Upload File");
- }
-
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
return vsp;
}
@Override
- public Version callAutoHeal(String vspId, VersionInfo versionInfo,
- VspDetails vendorSoftwareProductInfo, String user)
- throws Exception {
- switch (versionInfo.getStatus()) {
- case Locked:
- if (user.equals(versionInfo.getLockingUser())) {
- autoHeal(vspId, versionInfo.getActiveVersion(), vendorSoftwareProductInfo,
- versionInfo.getLockingUser());
- }
- return versionInfo.getActiveVersion();
- case Available:
- Version checkoutVersion = checkout(vspId, user);
- autoHeal(vspId, checkoutVersion, vendorSoftwareProductInfo, user);
- return checkin(vspId, user);
- case Final:
- return healAndAdvanceFinalVersion(vspId, vendorSoftwareProductInfo, user);
- default:
- //do nothing
- break;
- }
- return versionInfo.getActiveVersion();
- }
-
- public Version healAndAdvanceFinalVersion(String vspId, VspDetails vendorSoftwareProductInfo,
- String user) throws IOException {
-
- Version checkoutVersion = checkout(vspId, user);
- autoHeal(vspId, checkoutVersion, vendorSoftwareProductInfo, user);
- Version checkinVersion = checkin(vspId, user);
-
- ValidationResponse response = Objects.requireNonNull(submit(vspId, user),
- "Null response not expected");
-
- if (!response.isValid()) {
- return checkinVersion;
- }
-
- Version finalVersion = checkinVersion.calculateNextFinal();
- createPackage(vspId, finalVersion, user);
- return finalVersion;
- }
-
- @Override
- public void deleteVsp(String vspId, String user) {
+ public void deleteVsp(String vspId) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -862,88 +578,16 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public void heal(String vspId, Version version, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
-
- VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
-
- version = VersionStatus.Locked.equals(versionInfo.getStatus())
- ? versionInfo.getActiveVersion()
- : checkout(vspId, user);
- version.setStatus(VersionStatus.Locked);
-
- Optional<String> errorMessages =
- healingManager.healAll(getHealingParamsAsMap(vspId, version, user));
-
- VspDetails vspDetails = new VspDetails(vspId, version);
- vspDetails.setOldVersion(null);
- vspInfoDao.updateOldVersionIndication(vspDetails);
-
- LOGGER.audit("Healed VSP " + vspDetails.getId());
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
-
- errorMessages.ifPresent(s -> {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId("HEALING_ERROR")
- .withCategory(ErrorCategory.APPLICATION).withMessage(s).build());
- });
- }
-
- private void autoHeal(String vspId, Version checkoutVersion, VspDetails vspDetails, String user) {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
-
- checkoutVersion.setStatus(VersionStatus.Locked);
- Map<String, Object> healingParams = getHealingParamsAsMap(vspId, checkoutVersion, user);
-
- Optional<String> errorMessages = healingManager.healAll(healingParams);
-
- vspDetails.setVersion(checkoutVersion);
- vspDetails.setOldVersion(null);
- vspInfoDao.updateOldVersionIndication(vspDetails);
-
- LOGGER.audit("Healed VSP " + vspDetails.getName());
- MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
-
- errorMessages.ifPresent(s -> {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId("HEALING_ERROR")
- .withCategory(ErrorCategory.APPLICATION).withMessage(s).build());
- });
- }
-
- private Map<String, Object> getHealingParamsAsMap(String vspId, Version version, String user) {
- Map<String, Object> healingParams = new HashMap<>();
-
- healingParams.put(SdcCommon.VSP_ID, vspId);
- healingParams.put(SdcCommon.VERSION, version);
- healingParams.put(SdcCommon.USER, user);
-
- return healingParams;
- }
-
- @Override
public List<PackageInfo> listPackages(String category, String subCategory) {
return packageInfoDao.listByCategory(category, subCategory);
}
@Override
- public File getTranslatedFile(String vspId, Version version, String user) {
+ public File getTranslatedFile(String vspId, Version version) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
String errorMessage;
- if (version == null) {
- errorMessage = "Package not found";
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage);
- throw new CoreException(new PackageNotFoundErrorBuilder(vspId).build());
- } else if (!version.isFinal()) {
- errorMessage = "Invalid requested version";
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage);
- throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
- }
- PackageInfo packageInfo =
- packageInfoDao.get(new PackageInfo(vspId, version));
+ PackageInfo packageInfo = packageInfoDao.get(new PackageInfo(vspId, version));
if (packageInfo == null) {
errorMessage = "Package not found";
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -981,10 +625,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
- public byte[] getOrchestrationTemplateFile(String vspId, Version version, String user) {
+ public byte[] getOrchestrationTemplateFile(String vspId, Version version) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
- UploadDataEntity uploadData = orchestrationTemplateDao.getOrchestrationTemplate(vspId, version);
+ OrchestrationTemplateEntity uploadData = orchestrationTemplateDao.get(vspId, version);
ByteBuffer contentData = uploadData.getContentData();
if (contentData == null) {
return null;
@@ -993,7 +637,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (final ZipOutputStream zos = new ZipOutputStream(baos);
- ZipInputStream zipStream = new ZipInputStream(
+ ZipInputStream ignored = new ZipInputStream(
new ByteArrayInputStream(contentData.array()))) {
zos.write(contentData.array());
} catch (IOException exception) {
@@ -1008,29 +652,25 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public PackageInfo createPackage(String vspId, Version version, String user) throws IOException {
- MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
+ public OrchestrationTemplateEntity getOrchestrationTemplateInfo(String vspId, Version version) {
+ return orchestrationTemplateDao.getInfo(vspId, version);
+ }
- if (!version.isFinal()) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.CREATE_PACKAGE, ErrorLevel.ERROR.name(),
- LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create package");
- throw new CoreException(
- new CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(vspId, version)
- .build());
- }
+ @Override
+ public PackageInfo createPackage(String vspId, Version version) throws IOException {
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Version vlmVersion = vspDetails.getVlmVersion();
- PackageInfo packageInfo = createPackageInfo(vspId, vspDetails);
+ PackageInfo packageInfo = createPackageInfo(vspDetails);
ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar =
new ToscaFileOutputServiceCsarImpl();
FileContentHandler licenseArtifacts = licenseArtifactsService
.createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion,
- vspDetails.getFeatureGroups(), user);
+ vspDetails.getFeatureGroups());
//todo add tosca validation here
packageInfo.setTranslatedFile(ByteBuffer.wrap(
toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts)));
@@ -1043,10 +683,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return packageInfo;
}
- private PackageInfo createPackageInfo(String vspId, VspDetails vspDetails) {
- PackageInfo packageInfo = new PackageInfo();
- packageInfo.setVspId(vspId);
- packageInfo.setVersion(vspDetails.getVersion());
+ private PackageInfo createPackageInfo(VspDetails vspDetails) {
+ PackageInfo packageInfo = new PackageInfo(vspDetails.getId(), vspDetails.getVersion());
packageInfo.setVspName(vspDetails.getName());
packageInfo.setVspDescription(vspDetails.getDescription());
packageInfo.setCategory(vspDetails.getCategory());
@@ -1059,7 +697,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
- public QuestionnaireResponse getVspQuestionnaire(String vspId, Version version, String user) {
+ public QuestionnaireResponse getVspQuestionnaire(String vspId, Version version) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
VspQuestionnaireEntity retrieved = vspInfoDao.getQuestionnaire(vspId, version);
@@ -1078,8 +716,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public void updateVspQuestionnaire(String vspId, Version version, String questionnaireData,
- String user) {
+ public void updateVspQuestionnaire(String vspId, Version version, String questionnaireData) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData);
@@ -1088,21 +725,19 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
- private Map<String, List<ErrorMessage>> validateUploadData(UploadDataEntity uploadData,
- VspDetails vspDetails)
- throws IOException {
+ private Map<String, List<ErrorMessage>> validateOrchestrationTemplate(
+ OrchestrationTemplateEntity orchestrationTemplate) throws IOException {
- Map<String, List<ErrorMessage>> validationErrors = new HashMap<>();
- if (uploadData == null || uploadData.getContentData() == null) {
+ if (!isOrchestrationTemplateExist(orchestrationTemplate)) {
return null;
}
+ Map<String, List<ErrorMessage>> validationErrors = new HashMap<>();
- FileContentHandler fileContentMap =
- CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.getOnboardingTypesEnum
- (vspDetails.getOnboardingOrigin()),
- uploadData.getContentData().array());
+ FileContentHandler fileContentMap = CommonUtil.validateAndUploadFileContent(
+ OnboardingTypesEnum.getOnboardingTypesEnum(orchestrationTemplate.getFileSuffix()),
+ orchestrationTemplate.getContentData().array());
- if (CommonUtil.isFileOriginFromZip(vspDetails.getOnboardingOrigin())) {
+ if (CommonUtil.isFileOriginFromZip(orchestrationTemplate.getFileSuffix())) {
ValidationManager validationManager =
ValidationManagerUtil.initValidationManager(fileContentMap);
validationErrors.putAll(validationManager.validate());
@@ -1113,14 +748,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
? null : validationErrors;
}
- private VersionInfo getVersionInfo(String vendorSoftwareProductId, VersionableEntityAction action,
- String user) {
- return versioningManager.getEntityVersionInfo(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vendorSoftwareProductId, user, action);
- }
-
-
private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version,
String onboardingMethod) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
@@ -1132,7 +759,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
compositionEntityDataManager
.addEntity(vspInfoDao.getQuestionnaire(vspId, version), null);
- Collection<NicEntity> nics = vendorSoftwareProductDao.listNicsByVsp(vspId, version);
+ Collection<NicEntity> nics = nicDao.listByVsp(vspId, version);
Map<String, List<String>> nicNamesByComponent = new HashMap<>();
for (NicEntity nicEntity : nics) {
@@ -1147,16 +774,16 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
Collection<ComponentEntity> components =
- vendorSoftwareProductDao.listComponentsCompositionAndQuestionnaire(vspId, version);
+ componentDao.listCompositionAndQuestionnaire(vspId, version);
components.forEach(component -> compositionEntityDataManager.addEntity(component,
new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()),
JsonUtil.json2Object(component.getQuestionnaireData(), Map.class))));
- Collection<ComputeEntity> computes = vendorSoftwareProductDao.listComputesByVsp(vspId, version);
+ Collection<ComputeEntity> computes = computeDao.listByVsp(vspId, version);
computes.forEach(compute -> compositionEntityDataManager.addEntity(compute, null));
- if ("Manual".equals(onboardingMethod)) {
- Collection<ImageEntity> images = vendorSoftwareProductDao.listImagesByVsp(vspId, version);
+ if (OnboardingMethod.Manual.name().equals(onboardingMethod)) {
+ Collection<ImageEntity> images = imageDao.listByVsp(vspId, version);
images.forEach(image -> compositionEntityDataManager.addEntity(image, null));
}
@@ -1179,7 +806,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public File getInformationArtifact(String vspId, Version version, String user) {
+ public File getInformationArtifact(String vspId, Version version) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
@@ -1209,14 +836,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return infoArtifactFile;
}
- void validateUniqueName(String vspName) {
- UniqueValueUtil.validateUniqueValue(
- VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, vspName);
- }
-
- void createUniqueName(String vspName) {
- UniqueValueUtil.createUniqueValue(
- VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, vspName);
+ String getVspQuestionnaireSchema(SchemaTemplateInput schemaInput) {
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
+ return SchemaGenerator
+ .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput);
}
void updateUniqueName(String oldVspName, String newVspName) {
@@ -1226,13 +850,22 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public Collection<ComputeEntity> getComputeByVsp(String vspId, Version version,
- String user) {
- return vendorSoftwareProductDao.listComputesByVsp(vspId, version);
+ public Collection<ComputeEntity> getComputeByVsp(String vspId, Version version) {
+ return computeDao.listByVsp(vspId, version);
}
- private void auditIfContainsErrors(List<ErrorMessage> errorList, String vspId, String auditType) {
+ private boolean isOrchestrationTemplateExist(OrchestrationTemplateEntity orchestrationTemplate) {
+ return orchestrationTemplate != null &&
+ orchestrationTemplate.getContentData() != null &&
+ orchestrationTemplate.getFileSuffix() != null &&
+ orchestrationTemplate.getFileName() != null;
+ }
+ private boolean isServiceModelExist(ToscaServiceModel serviceModel) {
+ return serviceModel != null && serviceModel.getEntryDefinitionServiceTemplate() != null;
+ }
+
+ private void auditIfContainsErrors(List<ErrorMessage> errorList, String vspId, String auditType) {
errorList.forEach(errorMessage -> {
if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
LOGGER.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
@@ -1240,4 +873,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
});
}
+
+
}
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 5615f8f6b5..a2c0aea423 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
@@ -22,38 +22,38 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory;
import org.openecomp.core.model.dao.ServiceModelDaoFactory;
-import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
-import org.openecomp.sdc.healing.factory.HealingManagerFactory;
import org.openecomp.sdc.vendorlicense.VendorLicenseArtifactServiceFactory;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
+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.NicDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
public class VspManagerFactoryImpl extends VspManagerFactory {
private static final VendorSoftwareProductManager INSTANCE =
new VendorSoftwareProductManagerImpl(
- VersioningManagerFactory.getInstance().createInterface(),
- VendorSoftwareProductDaoFactory.getInstance().createInterface(),
OrchestrationTemplateDaoFactory.getInstance().createInterface(),
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
VendorLicenseFacadeFactory.getInstance().createInterface(),
ServiceModelDaoFactory.getInstance().createInterface(),
EnrichedServiceModelDaoFactory.getInstance().createInterface(),
- HealingManagerFactory.getInstance().createInterface(),
VendorLicenseArtifactServiceFactory.getInstance().createInterface(),
InformationArtifactGeneratorFactory.getInstance().createInterface(),
PackageInfoDaoFactory.getInstance().createInterface(),
- ActivityLogManagerFactory.getInstance().createInterface(),
DeploymentFlavorDaoFactory.getInstance().createInterface(),
+ ComponentDaoFactory.getInstance().createInterface(),
+ ComponentDependencyModelDaoFactory.getInstance().createInterface(),
NicDaoFactory.getInstance().createInterface(),
+ ComputeDaoFactory.getInstance().createInterface(),
+ ImageDaoFactory.getInstance().createInterface(),
new ManualVspToscaManagerImpl());
@Override
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 c7fb43770d..d20dc07b63 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
@@ -14,87 +14,94 @@ import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
-import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.InputStream;
import java.util.Optional;
+
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+
public abstract class BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler {
- protected static final Logger logger =
- LoggerFactory.getLogger(BaseOrchestrationTemplateHandler.class);
- protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-
- @Override
- public UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload, String user,
- CandidateService candidateService, VspDetails vspDetails) {
- UploadFileResponse uploadFileResponse = new UploadFileResponse();
- uploadFileResponse.setOnboardingType(getHandlerType());
- if (isNotEmptyFileToUpload(fileToUpload, uploadFileResponse, candidateService)) {
- return uploadFileResponse;
- }
-
- byte[] uploadedFileData = FileUtils.toByteArray(fileToUpload);
- if (isInvalidRawZipData(uploadFileResponse, uploadedFileData, candidateService)) {
- return uploadFileResponse;
- }
-
- Optional<FileContentHandler> optionalContentMap =
- getFileContentMap(uploadFileResponse, uploadedFileData);
- if (!optionalContentMap.isPresent()) {
- logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(), getHandlerType().toString()));
- uploadFileResponse
- .addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(), getHandlerType().toString())));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
- }
-
- if (!MapUtils.isEmpty(uploadFileResponse.getErrors())) {
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
- }
- if (updateCandidateData(vspId, user, candidateService, vspDetails, uploadFileResponse,
- uploadedFileData, optionalContentMap))
- return uploadFileResponse;
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
+ protected static final Logger logger =
+ LoggerFactory.getLogger(BaseOrchestrationTemplateHandler.class);
+ protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ @Override
+ public UploadFileResponse upload(VspDetails vspDetails, InputStream fileToUpload,
+ String fileSuffix, String networkPackageName,
+ CandidateService candidateService) {
+ UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ uploadFileResponse.setOnboardingType(getHandlerType());
+ if (isNotEmptyFileToUpload(fileToUpload, uploadFileResponse, candidateService)) {
+ return uploadFileResponse;
+ }
+
+ byte[] uploadedFileData = FileUtils.toByteArray(fileToUpload);
+ if (isInvalidRawZipData(uploadFileResponse, uploadedFileData, candidateService)) {
+ return uploadFileResponse;
+ }
+
+ Optional<FileContentHandler> optionalContentMap =
+ getFileContentMap(uploadFileResponse, uploadedFileData);
+ if (!optionalContentMap.isPresent()) {
+ logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
+ getHandlerType().toString()));
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
+ getHandlerType().toString())));
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+ return uploadFileResponse;
}
- protected abstract boolean updateCandidateData(String vspId, String user, CandidateService candidateService,
- VspDetails vspDetails, UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData,
- Optional<FileContentHandler> optionalContentMap);
-
-
- private boolean isNotEmptyFileToUpload(InputStream fileToUpload,
- UploadFileResponse uploadFileResponse, CandidateService candidateService) {
- Optional<ErrorMessage> errorMessage =
- candidateService.validateNonEmptyFileToUpload(fileToUpload);
- if (errorMessage.isPresent()) {
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
- return true;
- }
- return false;
+ if (!MapUtils.isEmpty(uploadFileResponse.getErrors())) {
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+ return uploadFileResponse;
}
+ if (updateCandidateData(vspDetails, uploadedFileData, optionalContentMap.get(), fileSuffix,
+ networkPackageName, candidateService, uploadFileResponse)) {
+ return uploadFileResponse;
+ }
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+ return uploadFileResponse;
+
+ }
+
+ protected abstract boolean updateCandidateData(VspDetails vspDetails,
+ byte[] uploadedFileData,
+ FileContentHandler contentMap,
+ String fileSuffix,
+ String networkPackageName,
+ CandidateService candidateService,
+ UploadFileResponse uploadFileResponse);
- protected boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData, CandidateService candidateService) {
- Optional<ErrorMessage> errorMessage;
- errorMessage = candidateService.validateRawZipData(uploadedFileData);
- if (errorMessage.isPresent()) {
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
- return true;
- }
- return false;
+ private boolean isNotEmptyFileToUpload(InputStream fileToUpload,
+ UploadFileResponse uploadFileResponse,
+ CandidateService candidateService) {
+ Optional<ErrorMessage> errorMessage =
+ candidateService.validateNonEmptyFileToUpload(fileToUpload);
+ if (errorMessage.isPresent()) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
+ return true;
}
+ return false;
+ }
+
+ protected boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData,
+ CandidateService candidateService) {
+ Optional<ErrorMessage> errorMessage;
+ errorMessage = candidateService.validateRawZipData(uploadedFileData);
+ if (errorMessage.isPresent()) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
+ return true;
+ }
+ return false;
+ }
+
+ public abstract Optional<FileContentHandler> getFileContentMap(
+ UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData);
- public abstract Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData);
- 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 db0851cd5f..16147553fe 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
@@ -30,131 +30,139 @@ import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CS
import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME;
public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler
- implements OrchestrationTemplateFileHandler {
-
-
- @Override
- public Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData) {
- FileContentHandler contentMap = null;
- List<String> folderList = new ArrayList<>();
- try {
- Pair<FileContentHandler, List<String>> fileContentMapFromOrchestrationCandidateZip = CommonUtil.getFileContentMapFromOrchestrationCandidateZip(uploadedFileData);
- contentMap = fileContentMapFromOrchestrationCandidateZip.getKey();
- folderList = fileContentMapFromOrchestrationCandidateZip.getRight();
- } catch (IOException exception) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_CSAR_FILE.getErrorMessage()));
- } catch (CoreException coreException) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
- }
- validateContent(uploadFileResponse, contentMap, folderList);
- return Optional.ofNullable(contentMap);
+ implements OrchestrationTemplateFileHandler {
+
+
+ @Override
+ public Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData) {
+ FileContentHandler contentMap = null;
+ List<String> folderList = new ArrayList<>();
+ try {
+ Pair<FileContentHandler, List<String>> fileContentMapFromOrchestrationCandidateZip =
+ CommonUtil.getFileContentMapFromOrchestrationCandidateZip(uploadedFileData);
+ contentMap = fileContentMapFromOrchestrationCandidateZip.getKey();
+ folderList = fileContentMapFromOrchestrationCandidateZip.getRight();
+ } catch (IOException exception) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_CSAR_FILE.getErrorMessage()));
+ } catch (CoreException coreException) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
}
-
- private void validateContent(UploadFileResponse uploadFileResponse, FileContentHandler contentMap, List<String> folderList) {
- validateManifest(uploadFileResponse, contentMap);
- validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
- validateNoExtraFiles(uploadFileResponse, contentMap);
- validateFolders(uploadFileResponse, folderList);
+ validateContent(uploadFileResponse, contentMap, folderList);
+ return Optional.ofNullable(contentMap);
+ }
+
+ private void validateContent(UploadFileResponse uploadFileResponse, FileContentHandler contentMap,
+ List<String> folderList) {
+ validateManifest(uploadFileResponse, contentMap);
+ validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
+ validateNoExtraFiles(uploadFileResponse, contentMap);
+ validateFolders(uploadFileResponse, folderList);
+ }
+
+ private void validateManifest(UploadFileResponse uploadFileResponse,
+ FileContentHandler contentMap) {
+
+ if (!validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
+ return;
}
- private void validateManifest(UploadFileResponse uploadFileResponse, FileContentHandler contentMap) {
-
- if (!validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)){
- return;
- }
-
- try (InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
+ try (InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
- if (!onboardingManifest.isValid()) {
- onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
- }
+ OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
+ if (!onboardingManifest.isValid()) {
+ onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
+ }
- } catch (IOException e) {
- // convert to runtime to keep the throws unchanged
- throw new RuntimeException("Failed to validate manifest", e);
- }
+ } catch (IOException e) {
+ // convert to runtime to keep the throws unchanged
+ throw new RuntimeException("Failed to validate manifest", e);
}
-
- private void validateNoExtraFiles(UploadFileResponse uploadFileResponse, FileContentHandler contentMap) {
- List<String> unwantedFiles = contentMap.getFileList().stream()
- .filter(this::filterFiles).collect(Collectors.toList());
- if (!unwantedFiles.isEmpty()) {
- unwantedFiles.stream().filter(this::filterFiles).forEach(unwantedFile ->
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.CSAR_FILES_NOT_ALLOWED.getErrorMessage(),
- unwantedFile))));
- }
+ }
+
+ private void validateNoExtraFiles(UploadFileResponse uploadFileResponse,
+ FileContentHandler contentMap) {
+ List<String> unwantedFiles = contentMap.getFileList().stream()
+ .filter(this::filterFiles).collect(Collectors.toList());
+ if (!unwantedFiles.isEmpty()) {
+ unwantedFiles.stream().filter(this::filterFiles).forEach(unwantedFile ->
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.CSAR_FILES_NOT_ALLOWED.getErrorMessage(),
+ unwantedFile))));
}
+ }
+
+ private void validateFolders(UploadFileResponse uploadFileResponse, List<String> folderList) {
+ List<String> filterResult =
+ folderList.stream().filter(this::filterFolders).collect(Collectors.toList());
+ if (!filterResult.isEmpty()) {
+ folderList.stream().filter(this::filterFolders).forEach(unwantedFolder ->
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.CSAR_DIRECTORIES_NOT_ALLOWED.getErrorMessage(),
+ unwantedFolder))));
- private void validateFolders(UploadFileResponse uploadFileResponse, List<String> folderList) {
- List<String> filterResult = folderList.stream().filter(this::filterFolders).collect(Collectors.toList());
- if (!filterResult.isEmpty()) {
- folderList.stream().filter(this::filterFolders).forEach( unwantedFolder ->
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.CSAR_DIRECTORIES_NOT_ALLOWED.getErrorMessage(),
- unwantedFolder))));
-
- }
- }
- private boolean filterFiles(String inFileName) {
- boolean valid = ELIGIBLE_FILES.stream().anyMatch(fileName -> fileName.equals(inFileName));
- return !valid && filterFolders(inFileName);
}
+ }
- private boolean filterFolders(String fileName) {
- return ELIGBLE_FOLDERS.stream().noneMatch(fileName::startsWith);
- }
+ private boolean filterFiles(String inFileName) {
+ boolean valid = ELIGIBLE_FILES.stream().anyMatch(fileName -> fileName.equals(inFileName));
+ return !valid && filterFolders(inFileName);
+ }
- private boolean validateFileExist(UploadFileResponse uploadFileResponse, FileContentHandler contentMap, String fileName) {
+ private boolean filterFolders(String fileName) {
+ return ELIGBLE_FOLDERS.stream().noneMatch(fileName::startsWith);
+ }
- boolean containsFile = contentMap.containsFile(fileName);
- if (!containsFile) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.CSAR_FILE_NOT_FOUND.getErrorMessage(), fileName)));
- }
- return containsFile;
- }
+ private boolean validateFileExist(UploadFileResponse uploadFileResponse,
+ FileContentHandler contentMap, String fileName) {
- @Override
- protected boolean updateCandidateData(String vspId, String user, CandidateService candidateService,
- VspDetails vspDetails, UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData, Optional<FileContentHandler> optionalContentMap) {
- try {
- candidateService.updateCandidateUploadData(new OrchestrationTemplateCandidateData(
- ByteBuffer.wrap(uploadedFileData), ""), vspDetails.getId());
- } catch (Exception exception) {
- logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
- getHandlerType().toString()), exception);
- uploadFileResponse
- .addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return true;
- }
- return false;
+ boolean containsFile = contentMap.containsFile(fileName);
+ if (!containsFile) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.CSAR_FILE_NOT_FOUND.getErrorMessage(), fileName)));
}
-
-
- @Override
- protected OnboardingTypesEnum getHandlerType() {
- return OnboardingTypesEnum.CSAR;
+ return containsFile;
+ }
+
+ @Override
+ protected boolean updateCandidateData(VspDetails vspDetails, byte[] uploadedFileData,
+ FileContentHandler contentMap,
+ String fileSuffix, String networkPackageName,
+ CandidateService candidateService,
+ UploadFileResponse uploadFileResponse) {
+ try {
+ candidateService.updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(),
+ new OrchestrationTemplateCandidateData(ByteBuffer.wrap(uploadedFileData), "", fileSuffix,
+ networkPackageName));
+ } catch (Exception exception) {
+ logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
+ getHandlerType().toString()), exception);
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+ return true;
}
+ return false;
+ }
- @Override
- protected boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData, CandidateService candidateService) {
- return super.isInvalidRawZipData(uploadFileResponse, uploadedFileData, candidateService);
- }
+ @Override
+ protected OnboardingTypesEnum getHandlerType() {
+ return OnboardingTypesEnum.CSAR;
+ }
+
+ @Override
+ protected boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData,
+ CandidateService candidateService) {
+ return super.isInvalidRawZipData(uploadFileResponse, uploadedFileData, candidateService);
+ }
}
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 3f7d18de9f..5e006a29bd 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
@@ -3,10 +3,12 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
-import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.InputStream;
+
public interface OrchestrationTemplateFileHandler {
- UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload, String user,
- CandidateService candidateService, VspDetails vspDetails);
+
+ UploadFileResponse upload(VspDetails vspDetails, InputStream fileToUpload,
+ String fileSuffix, String networkPackageName,
+ 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 626d941911..343c7460d9 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
@@ -15,41 +15,47 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import java.util.Optional;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+
public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHandler
- implements OrchestrationTemplateFileHandler {
+ implements OrchestrationTemplateFileHandler {
- @Override
- public Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData) {
- return OrchestrationUtil.getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, uploadedFileData);
- }
+ @Override
+ public Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData) {
+ return OrchestrationUtil
+ .getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, uploadedFileData);
+ }
- @Override
- protected boolean updateCandidateData(String vspId, String user, CandidateService candidateService,
- VspDetails vspDetails, UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData, Optional<FileContentHandler> optionalContentMap) {
- try {
- OrchestrationTemplateCandidateData candidateData =
- new CandidateEntityBuilder(candidateService)
- .buildCandidateEntityFromZip(vspDetails, uploadedFileData, optionalContentMap.get(),
- uploadFileResponse.getErrors(), user);
- candidateService.updateCandidateUploadData(candidateData, vspDetails.getId());
- } catch (Exception exception) {
- logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
- getHandlerType().toString()),exception);
- uploadFileResponse
- .addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return true;
- }
- return false;
- }
+ @Override
+ protected boolean updateCandidateData(VspDetails vspDetails, byte[] uploadedFileData,
+ FileContentHandler contentMap,
+ String fileSuffix, String networkPackageName,
+ CandidateService candidateService,
+ UploadFileResponse uploadFileResponse) {
+ try {
+ OrchestrationTemplateCandidateData candidateData =
+ new CandidateEntityBuilder(candidateService)
+ .buildCandidateEntityFromZip(vspDetails, uploadedFileData, contentMap,
+ uploadFileResponse.getErrors());
+ candidateData.setFileSuffix(fileSuffix);
+ candidateData.setFileName(networkPackageName);
- @Override
- protected OnboardingTypesEnum getHandlerType() {
- return OnboardingTypesEnum.ZIP;
+ candidateService
+ .updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(), candidateData);
+ } catch (Exception exception) {
+ logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
+ getHandlerType().toString()), exception);
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+ return true;
}
+ return false;
+ }
+
+ @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 99b311e473..3c3ab81e10 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
@@ -24,8 +24,8 @@ public class OrchestrationUploadFactory {
}
- public static final OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(String filePrefix) {
- String fileExtension = filePrefix.toLowerCase();
+ public static final OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(String fileSuffix) {
+ String fileExtension = fileSuffix.toLowerCase();
ImplementationConfiguration orchestrationTemplateFileHandler = fileHanlders.get(fileExtension);
if(Objects.isNull(orchestrationTemplateFileHandler)){
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 2ee7b263b9..e312e7c576 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
@@ -1,8 +1,5 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
-
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.model.dao.ServiceModelDao;
@@ -35,14 +32,16 @@ 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.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+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.UploadData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
@@ -62,13 +61,13 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
+
public class OrchestrationUtil {
public static final String ORCHESTRATION_CONFIG_NAMESPACE = "orchestration";
public static final String ORCHESTRATION_IMPL_KEY = "orchestration_impl";
-
- private VendorSoftwareProductDao vendorSoftwareProductDao;
private NicDao nicDao;
private ComponentArtifactDao componentArtifactDao;
private ProcessDao processDao;
@@ -80,8 +79,7 @@ public class OrchestrationUtil {
private CompositionDataExtractor compositionDataExtractor;
public OrchestrationUtil() {
- this (VendorSoftwareProductDaoFactory.getInstance().createInterface(),
- NicDaoFactory.getInstance().createInterface(),
+ this(NicDaoFactory.getInstance().createInterface(),
MonitoringUploadDaoFactory.getInstance().createInterface(),
ProcessDaoFactory.getInstance().createInterface(),
OrchestrationTemplateDaoFactory.getInstance().createInterface(),
@@ -93,7 +91,6 @@ public class OrchestrationUtil {
}
public OrchestrationUtil(
- VendorSoftwareProductDao vendorSoftwareProductDao,
NicDao nicDao,
ComponentArtifactDao componentArtifactDao,
ProcessDao processDao,
@@ -103,7 +100,6 @@ public class OrchestrationUtil {
ComponentDependencyModelDao componentDependencyModelDao,
CompositionEntityDataManager compositionEntityDataManager,
CompositionDataExtractor compositionDataExtractor) {
- this.vendorSoftwareProductDao = vendorSoftwareProductDao;
this.nicDao = nicDao;
this.componentArtifactDao = componentArtifactDao;
this.processDao = processDao;
@@ -116,8 +112,7 @@ public class OrchestrationUtil {
}
public static Optional<FileContentHandler> getFileContentMap(OnboardingTypesEnum type,
- UploadFileResponse
- uploadFileResponse,
+ UploadFileResponse uploadFileResponse,
byte[] uploadedFileData) {
FileContentHandler contentMap = null;
try {
@@ -133,95 +128,63 @@ public class OrchestrationUtil {
return Optional.ofNullable(contentMap);
}
- public void backupComponentsQuestionnaireBeforeDelete(String vspId, Version activeVersion,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>>
- componentMibList,
- Map<String, Collection<ProcessEntity>>
- componentProcesses,
- Map<String, ProcessEntity> processArtifact) {
- //backup VSP processes
- backupProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID,
- componentProcesses, processArtifact);
- Collection<ComponentEntity> componentsCompositionAndQuestionnaire = vendorSoftwareProductDao
- .listComponentsCompositionAndQuestionnaire(vspId,
- activeVersion);
+ 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 ->
- backupComponentQuestionnaire(vspId, activeVersion, componentEntity, componentsQustanniare,
+ backupComponentQuestionnaire(vspId, version, componentEntity, componentsQustanniare,
componentNicsQustanniare, componentMibList, componentProcesses, processArtifact));
}
- private void backupComponentQuestionnaire(String vspId, Version activeVersion,
- ComponentEntity componentEntity,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>>
- componentMibList,
- Map<String, Collection<ProcessEntity>>
- componentProcesses,
- Map<String, ProcessEntity> processArtifact) {
+ private void backupComponentQuestionnaire(
+ String vspId, Version version,
+ ComponentEntity componentEntity,
+ Map<String, String> componentsQustanniare,
+ Map<String, Map<String, String>> componentNicsQustanniare,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
+ Map<String, Collection<ProcessEntity>> componentProcesses,
+ Map<String, ProcessEntity> processArtifact) {
String componentName = componentEntity.getComponentCompositionData().getName();
- backupMibData(componentsQustanniare, componentMibList, componentName, componentEntity, vspId,
- activeVersion);
- backupComponentProcessData(componentNicsQustanniare, vspId, activeVersion, componentName,
- componentEntity, componentProcesses, processArtifact);
+ 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(Map<String, String> componentsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>>
- componentMibList,
- String componentName, ComponentEntity componentEntity,
- String vspId, Version activeVersion) {
- componentsQustanniare.put(componentName, componentEntity.getQuestionnaireData());
- //backup mib
+ private void backupMibData(String vspId, Version version, ComponentEntity componentEntity,
+ String componentName,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList) {
Collection<ComponentMonitoringUploadEntity> componentMib =
componentArtifactDao.listArtifacts(new
- ComponentMonitoringUploadEntity(vspId, activeVersion, componentEntity.getId(), null));
+ ComponentMonitoringUploadEntity(vspId, version, componentEntity.getId(),
+ null));
if (CollectionUtils.isNotEmpty(componentMib)) {
componentMibList.put(componentName, componentMib);
}
}
- private void backupComponentProcessData(Map<String, Map<String, String>> componentNicsQustanniare,
- String vspId, Version activeVersion, String componentName,
- ComponentEntity componentEntity,
- Map<String, Collection<ProcessEntity>> componentProcesses,
- Map<String, ProcessEntity> processArtifact) {
- Collection<NicEntity>
- nics = nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
- //backup component processes
- backupProcess(vspId, activeVersion, componentEntity.getId(), componentName,
- componentProcesses, processArtifact);
- if (CollectionUtils.isNotEmpty(nics)) {
- Map<String, String> nicsQustanniare = new HashMap<>();
- nics.forEach(nicEntity -> {
- NicEntity nic = nicDao.get(new NicEntity(vspId, activeVersion, componentEntity.getId(),
- nicEntity.getId()));
- NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, activeVersion,
- componentEntity.getId(), nicEntity.getId());
-
- nicsQustanniare
- .put(nicEntity.getNicCompositionData().getName(),
- nicQuestionnaire.getQuestionnaireData());
- });
- componentNicsQustanniare.put(componentName, nicsQustanniare);
- }
- }
-
- private void backupProcess(String vspId, Version activeVersion, String componentId,
- String componentName, Map<String,
+ private void backupProcess(String vspId, Version version, String componentId,
+ String componentName, Map<String,
Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- Collection<ProcessEntity> processList = vendorSoftwareProductDao.listProcesses(vspId,
- activeVersion, componentId);
+ 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.get(new ProcessEntity(vspId, activeVersion, componentId, process.getId()));
+ ProcessEntity artifact = processDao
+ .getArtifact(new ProcessEntity(vspId, version, componentId, process.getId()));
if (artifact.getArtifact() != null) {
processArtifact.put(process.getId(), artifact);
}
@@ -229,29 +192,45 @@ public class OrchestrationUtil {
}
}
- public void retainComponentQuestionnaireData(String vspId, Version activeVersion,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
- Map<String, Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
+ 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 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, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID, processes,
- processArtifact);
- Collection<ComponentEntity>
- components = vendorSoftwareProductDao.listComponents(vspId, activeVersion);
+ 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)) {
- //Restore component questionnaire
- componentDao.updateQuestionnaireData(vspId, activeVersion,
+ componentDao.updateQuestionnaireData(vspId, version,
componentEntity.getId(),
componentsQustanniare.get(componentEntity.getComponentCompositionData()
.getName()));
- //Restore component nic questionnaire
if (componentNicsQustanniare.containsKey(componentName)) {
- restoreComponentNicQuestionnaire(vspId, activeVersion, componentName, componentEntity,
+ restoreComponentNicQuestionnaire(vspId, version, componentName, componentEntity,
componentNicsQustanniare);
}
//MIB //todo add for VES_EVENTS
@@ -259,33 +238,30 @@ public class OrchestrationUtil {
restoreComponentMibData(componentName, componentEntity, componentMibList);
}
//VFC processes
- restoreProcess(vspId, activeVersion, componentEntity.getId(), componentName, processes,
+ restoreProcess(vspId, version, componentEntity.getId(), componentName, processes,
processArtifact);
}
});
}
- private void restoreComponentNicQuestionnaire(String vspId, Version activeVersion,
+ private void restoreComponentNicQuestionnaire(String vspId, Version version,
String componentName,
ComponentEntity componentEntity,
- Map<String, Map<String, String>>
- componentNicsQustanniare) {
+ Map<String, Map<String, String>> componentNicsQustanniare) {
Map<String, String> nicsQustanniare = componentNicsQustanniare.get(componentName);
Collection<NicEntity> nics =
- nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
+ nicDao.list(new NicEntity(vspId, version, componentEntity.getId(), null));
nics.forEach(nicEntity -> {
if (nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())) {
- nicDao.updateQuestionnaireData(vspId, activeVersion,
+ 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) {
+ 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());
@@ -293,54 +269,58 @@ public class OrchestrationUtil {
});
}
- private void restoreProcess(String vspId, Version activeVersion, String componentId,
- String componentName,
- Map<String, Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
+ 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 -> {
- //Reatin VFC process
- if (!GENERAL_COMPONENT_ID.equals(componentId)
- && processArtifact.containsKey(process.getId())) {
+ process.setComponentId(componentId);
+ UniqueValueUtil.createUniqueValue(PROCESS_NAME, vspId, version.getId(), componentId,
+ process.getName());
+ processDao.create(process);
+ if (processArtifact.containsKey(process.getId())) {
ProcessEntity artifact = processArtifact.get(process.getId());
- artifact.setComponentId(componentId);
- UniqueValueUtil.createUniqueValue(PROCESS_NAME, vspId, activeVersion.toString(),
- componentId, process.getName());
- vendorSoftwareProductDao.createProcess(artifact);
+ processDao.uploadArtifact(artifact);
}
});
}
}
public void deleteUploadDataAndContent(String vspId, Version version) {
- //fixme change this when more tables are zusammenized
- vendorSoftwareProductDao.deleteUploadData(vspId, version);
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface()
+ .delete(new VspDetails(vspId, version));
}
- public void saveUploadData(String vspId, Version activeVersion,
- InputStream uploadedFileData,
- FileContentHandler fileContentMap, HeatStructureTree tree) {
+ 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.getFileContent(
SdcCommon.MANIFEST_NAME), Map.class)
: new HashMap<>();
- UploadData uploadData = new UploadData();
+ 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"));
- orchestrationTemplateDataDao.updateOrchestrationTemplateData(vspId, uploadData);
+ orchestrationTemplateDataDao.update(vspDetails.getId(), vspDetails.getVersion(), uploadData);
+
+ VspMergeDaoFactory.getInstance().createInterface()
+ .updateVspModelId(vspDetails.getId(), vspDetails.getVersion());
}
- public void saveServiceModel(String vspId,
- Version version,
- ToscaServiceModel serviceModelToExtract,
- ToscaServiceModel serviceModelToStore) {
+ 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
@@ -358,15 +338,14 @@ public class OrchestrationUtil {
return heatTreeManager.getTree();
}
- public void updateVspComponentDependencies(String vspId, Version activeVersion,
- Map<String, String>
- vspComponentIdNameInfoBeforeProcess) {
- Map<String, String> updatedVspComponentNameIdInfo = getVspComponentNameIdInfo(vspId,
- activeVersion);
+ public void updateVspComponentDependencies(String vspId, Version version,
+ Map<String, String> vspComponentIdNameInfoBeforeProcess) {
+ Map<String, String> updatedVspComponentNameIdInfo = getVspComponentNameIdInfo(vspId, version);
if (MapUtils.isNotEmpty(updatedVspComponentNameIdInfo)) {
Set<String> updatedVspComponentNames = updatedVspComponentNameIdInfo.keySet();
Collection<ComponentDependencyModelEntity> componentDependencies =
- vendorSoftwareProductDao.listComponentDependencies(vspId, activeVersion);
+ componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId,
+ version, null));
if (CollectionUtils.isNotEmpty(componentDependencies)) {
updateComponentDependency(vspComponentIdNameInfoBeforeProcess, componentDependencies,
updatedVspComponentNames, updatedVspComponentNameIdInfo);
@@ -374,7 +353,6 @@ public class OrchestrationUtil {
}
}
-
private void updateComponentDependency(Map<String, String> vspComponentIdNameInfoBeforeProcess,
Collection<ComponentDependencyModelEntity>
componentDependencies,
@@ -398,14 +376,14 @@ public class OrchestrationUtil {
}
}
- public Map<String, String> getVspComponentIdNameInfo(String vspId, Version activeVersion) {
+ public Map<String, String> getVspComponentIdNameInfo(String vspId, Version version) {
Collection<ComponentEntity> updatedVspComponents =
- vendorSoftwareProductDao.listComponents(vspId, activeVersion);
+ 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 -> componentEntity.getId(),
+ .collect(Collectors.toMap(ComponentEntity::getId,
componentEntity -> componentEntity.getComponentCompositionData().getName()));
}
@@ -413,15 +391,16 @@ public class OrchestrationUtil {
}
private Map<String, String> getVspComponentNameIdInfo(String vspId,
- Version activeVersion) {
+ Version version) {
Collection<ComponentEntity> updatedVspComponents =
- vendorSoftwareProductDao.listComponents(vspId, activeVersion);
+ 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 -> componentEntity.getId()));
+ .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/CSARConstants.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
index 0d204ef2c0..cf04aadcfc 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
@@ -1,6 +1,7 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
import com.google.common.collect.ImmutableSet;
+
import static com.google.common.collect.ImmutableSet.of;
public class CSARConstants {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
index d88d883e67..c0da130a9f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
@@ -7,12 +7,22 @@ import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.METADATA_MF_ATTRIBUTE;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.SOURCE_MF_ATTRIBUTE;
public class OnboardingManifest {
private static final Logger logger = LoggerFactory.getLogger(OnboardingManifest.class);
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 516d85c2a7..6200b287a1 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
@@ -27,13 +27,13 @@ public class OrchestrationProcessFactory {
}
- public static Optional<OrchestrationTemplateProcessHandler> getInstance(String filePrefix) {
- if (filePrefix == null) {
+ public static Optional<OrchestrationTemplateProcessHandler> getInstance(String fileSuffix) {
+ if (fileSuffix == null) {
return Optional.empty();
}
- filePrefix = filePrefix.toLowerCase().trim();
- OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(filePrefix);
+ fileSuffix = fileSuffix.toLowerCase().trim();
+ OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(fileSuffix);
if (onboardingTypesEnum == null) {
return Optional.empty();
}
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 d217c31f65..b0e1e17f57 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
@@ -1,7 +1,6 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
import org.apache.commons.collections4.MapUtils;
-import org.openecomp.core.converter.ToscaConverter;
import org.openecomp.core.impl.ToscaConverterImpl;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
@@ -26,7 +25,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationU
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
-import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -37,35 +35,35 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
-public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTemplateProcessHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
- private CandidateService candidateService = CandidateServiceFactory.getInstance().createInterface();
+public class OrchestrationTemplateProcessCsarHandler
+ implements OrchestrationTemplateProcessHandler {
+ private static final Logger LOGGER =
+ LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
+ private CandidateService candidateService =
+ CandidateServiceFactory.getInstance().createInterface();
ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
@Override
public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData,
- String user) {
- String vspId = vspDetails.getId();
- Version version = vspDetails.getVersion();
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CSAR_VALIDATION_STARTED + vspId);
- OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
+ OrchestrationTemplateCandidateData candidateData) {
+ LOGGER.audit(
+ AuditMessages.AUDIT_MSG + AuditMessages.CSAR_VALIDATION_STARTED + vspDetails.getId());
+
UploadFileResponse uploadFileResponse = new UploadFileResponse();
- Optional<FileContentHandler> fileContent =
- OrchestrationUtil
- .getFileContentMap(
- OnboardingTypesEnum.CSAR, uploadFileResponse, candidateData.getContentData().array());
+ Optional<FileContentHandler> fileContent = OrchestrationUtil
+ .getFileContentMap(OnboardingTypesEnum.CSAR, uploadFileResponse,
+ candidateData.getContentData().array());
- if(fileContent.isPresent()){
+ OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
+ if (fileContent.isPresent()) {
try {
FileContentHandler fileContentHandler = fileContent.get();
- processCsar(vspId, version, fileContentHandler, candidateData, response);
- } catch (CoreException e){
- logger.error(e.getMessage());
+ processCsar(vspDetails, fileContentHandler, candidateData, response);
+ } catch (CoreException e) {
+ LOGGER.error(e.getMessage());
response.addErrorMessageToMap(e.code().id(), e.code().message(),ErrorLevel.ERROR);
} catch (IOException ioe) {
- logger.error(ioe.getMessage());
+ LOGGER.error(ioe.getMessage());
ErrorCode errorCode = new GeneralErrorBuilder(ioe.getMessage()).build();
response.addErrorMessageToMap(errorCode.id(), errorCode.message(),ErrorLevel.ERROR);
}
@@ -77,13 +75,13 @@ public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTem
return response;
}
- private void processCsar(String vspId, Version version,
+ 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, response);
- if(!isValid(errors)){
+ Map<String, List<ErrorMessage>> errors = validateCsar(fileContentHandler);
+ if (!isValid(errors)) {
return;
}
@@ -95,32 +93,31 @@ public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTem
Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
Map<String, ProcessEntity> processArtifact = new HashMap<>();
OrchestrationUtil orchestrationUtil = new OrchestrationUtil();
- orchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspId,
- version, componentsQuestionnaire,
+ orchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspDetails.getId(),
+ vspDetails.getVersion(), componentsQuestionnaire,
componentNicsQuestionnaire, componentMibList, processes, processArtifact);
Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
- .fetchZipFileByteArrayInputStream(vspId, candidateData, null, OnboardingTypesEnum.CSAR, errors);
+ .fetchZipFileByteArrayInputStream(vspDetails.getId(), candidateData, null,
+ OnboardingTypesEnum.CSAR, errors);
- orchestrationUtil.deleteUploadDataAndContent(vspId, version);
- orchestrationUtil.saveUploadData(
- vspId, version, zipByteArrayInputStream.get(), fileContentHandler, tree);
+ orchestrationUtil.deleteUploadDataAndContent(vspDetails.getId(), vspDetails.getVersion());
+ orchestrationUtil.saveUploadData(vspDetails, candidateData, zipByteArrayInputStream.get(),
+ fileContentHandler, tree);
ToscaServiceModel toscaServiceModel = new ToscaConverterImpl().convert(fileContentHandler);
- orchestrationUtil.saveServiceModel(vspId, version, toscaServiceModel, toscaServiceModel);
+ orchestrationUtil.saveServiceModel(vspDetails.getId(), vspDetails.getVersion(), toscaServiceModel,
+ toscaServiceModel);
}
- private void addFiles(FileContentHandler fileContentHandler){
- for(Map.Entry<String, byte[]> fileEntry : fileContentHandler.getFiles().entrySet()){
+ 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,
- OrchestrationTemplateActionResponse response){
-
-
+ private Map<String, List<ErrorMessage>> validateCsar(FileContentHandler fileContentHandler) {
Map<String, List<ErrorMessage>> errors = new HashMap<>();
addFiles(fileContentHandler);
toscaTreeManager.createTree();
@@ -129,7 +126,7 @@ public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTem
return errors;
}
- private boolean isValid(Map<String, List<ErrorMessage>> 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 8b513b4347..1db48a5cc7 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
@@ -6,7 +6,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
public interface OrchestrationTemplateProcessHandler {
+
OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData,
- String user);
+ 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 85ac26223f..da5cb01c79 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
@@ -1,19 +1,12 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
-import static org.openecomp.sdc.logging.messages.AuditMessages.HEAT_VALIDATION_ERROR;
-
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
-import org.openecomp.core.model.dao.ServiceModelDao;
-import org.openecomp.core.model.dao.ServiceModelDaoFactory;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.core.validation.util.MessageContainerUtil;
-import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
@@ -31,18 +24,13 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCan
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.factory.CompositionDataExtractorFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil;
-import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
-import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdcrests.activitylog.types.ActivityType;
import java.io.ByteArrayInputStream;
import java.util.Collection;
@@ -51,41 +39,29 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+import static org.openecomp.sdc.logging.messages.AuditMessages.HEAT_VALIDATION_ERROR;
+
public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemplateProcessHandler {
- Logger logger = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class);
+ private Logger logger = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class);
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private CandidateService candidateService =
CandidateServiceFactory.getInstance().createInterface();
- private ServiceModelDao serviceModelDao = ServiceModelDaoFactory.getInstance().createInterface();
- private CompositionEntityDataManager compositionEntityDataManager =
- CompositionEntityDataManagerFactory.getInstance().createInterface();
- private CompositionDataExtractor compositionDataExtractor =
- CompositionDataExtractorFactory.getInstance().createInterface();
- private ActivityLogManager activityLogManager =
- ActivityLogManagerFactory.getInstance().createInterface();
-
-
- public OrchestrationTemplateProcessZipHandler(){}
+ @Override
public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData
- candidateData,
- String user) {
+ OrchestrationTemplateCandidateData candidateData) {
String vspId = vspDetails.getId();
Version version = vspDetails.getVersion();
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_STARTED
- + vspId);
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_STARTED + vspId);
OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
UploadFileResponse uploadFileResponse = new UploadFileResponse();
- Optional<FileContentHandler> fileContent =
- OrchestrationUtil
- .getFileContentMap(
- OnboardingTypesEnum.ZIP, uploadFileResponse,
- candidateData.getContentData().array());
+ Optional<FileContentHandler> fileContent = OrchestrationUtil
+ .getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse,
+ candidateData.getContentData().array());
if (!fileContent.isPresent()) {
response.addStructureErrors(uploadFileResponse.getErrors());
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId,
HEAT_VALIDATION_ERROR));
return response;
}
@@ -100,7 +76,7 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR);
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId,
HEAT_VALIDATION_ERROR));
return response;
}
@@ -113,8 +89,8 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
.fetchZipFileByteArrayInputStream(
vspId, candidateData, manifest, OnboardingTypesEnum.ZIP, uploadErrors);
if (!zipByteArrayInputStream.isPresent()) {
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
- HEAT_VALIDATION_ERROR));
+ response.getErrors().values()
+ .forEach(errorList -> printAuditForErrors(errorList, vspId, HEAT_VALIDATION_ERROR));
return response;
}
@@ -129,18 +105,19 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
OrchestrationUtil orchestrationUtil = new OrchestrationUtil();
Map<String, String> vspComponentIdNameInfoBeforeProcess =
orchestrationUtil.getVspComponentIdNameInfo(vspId, version);
- orchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspId,
- version, componentsQuestionnaire,
- componentNicsQuestionnaire, componentMibList, processes, processArtifact);
+ orchestrationUtil
+ .backupComponentsQuestionnaireBeforeDelete(vspId, version, componentsQuestionnaire,
+ componentNicsQuestionnaire, componentMibList, processes, processArtifact);
orchestrationUtil.deleteUploadDataAndContent(vspId, version);
- orchestrationUtil.saveUploadData(vspId, version, zipByteArrayInputStream.get(), fileContentMap,
- tree);
+ orchestrationUtil
+ .saveUploadData(vspDetails, candidateData, zipByteArrayInputStream.get(), fileContentMap,
+ tree);
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId,
HEAT_VALIDATION_ERROR));
- if ( MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR,
- response.getErrors()))) {
+ if (MapUtils
+ .isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, response.getErrors()))) {
logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_COMPLETED + vspId);
}
@@ -150,20 +127,17 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap);
ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
- orchestrationUtil.saveServiceModel(vspId, version, translatorOutput
- .getNonUnifiedToscaServiceModel(), toscaServiceModel);
+ orchestrationUtil
+ .saveServiceModel(vspId, version, translatorOutput.getNonUnifiedToscaServiceModel(),
+ toscaServiceModel);
orchestrationUtil.retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire,
componentNicsQuestionnaire, componentMibList, processes, processArtifact);
orchestrationUtil.updateVspComponentDependencies(vspId, version,
vspComponentIdNameInfoBeforeProcess);
+
logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId);
uploadFileResponse.addStructureErrors(uploadErrors);
- ActivityLogEntity activityLogEntity =
- new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
- ActivityType.UPLOAD_HEAT.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
-
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return response;
}
@@ -182,8 +156,8 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp
errorList.forEach(errorMessage -> {
if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
- logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
- vspId));
+ logger.audit(
+ AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(), vspId));
}
});
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/FileDataStructureDto.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/FileDataStructureDto.java
deleted file mode 100644
index 8cb367367c..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/FileDataStructureDto.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.types;
-
-import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.Module;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Avrahamg
- * @since November 07, 2016
- */
-public class FileDataStructureDto {
- private List<Module> modules = new ArrayList<>();
- private List<String> unassigned = new ArrayList<>();
- private List<String> artifacts = new ArrayList<>();
- private List<String> nested = new ArrayList<>();
-
- public List<Module> getModules() {
- return modules;
- }
-
- public void setModules(List<Module> modules) {
- this.modules = modules;
- }
-
- public List<String> getUnassigned() {
- return unassigned;
- }
-
- public void setUnassigned(List<String> unassigned) {
- this.unassigned = unassigned;
- }
-
- public List<String> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(List<String> artifacts) {
- this.artifacts = artifacts;
- }
-
- public List<String> getNested() {
- return nested;
- }
-
- public void setNested(List<String> nested) {
- this.nested = nested;
- }
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/GetFileDataStructureResponseDTO.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/GetFileDataStructureResponseDTO.java
deleted file mode 100644
index c30978266f..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/GetFileDataStructureResponseDTO.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.types;
-
-import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.Module;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Avrahamg
- * @since November 07, 2016
- */
-public class GetFileDataStructureResponseDTO {
- private List<Module> modules = new ArrayList<>();
- private List<String> unassigned = new ArrayList<>();
- private List<String> artifacts = new ArrayList<>();
- private List<String> nested = new ArrayList<>();
-
- public List<Module> getModules() {
- return modules;
- }
-
- public void setModules(List<Module> modules) {
- this.modules = modules;
- }
-
- public List<String> getUnassigned() {
- return unassigned;
- }
-
- public void setUnassigned(List<String> unassigned) {
- this.unassigned = unassigned;
- }
-
- public List<String> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(List<String> artifacts) {
- this.artifacts = artifacts;
- }
-
- public List<String> getNested() {
- return nested;
- }
-
- public void setNested(List<String> nested) {
- this.nested = nested;
- }
-}