diff options
author | 2017-12-27 15:10:20 +0530 | |
---|---|---|
committer | 2017-12-31 07:43:47 +0000 | |
commit | 1d8133171e7e1b9a835f476d8ff39751966f7794 (patch) | |
tree | 9022711105cca6abcb260bf8ce0fb7c91b6bc351 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp | |
parent | 15b15e3cbe40d8aa58eca93611c1902835400e3a (diff) |
Refactored as discussed - OrchestrationUtil
Remvoed exception handling and Constructor fix
Change-Id: I6a97f31d429848fa3c008892c48358bc7f67536a
Issue-ID: SDC-343
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java | 99 |
1 files changed, 52 insertions, 47 deletions
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 e312e7c576..8211749fe1 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,3 +1,19 @@ +/* + * Copyright © 2016-2017 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration; import org.apache.commons.collections4.CollectionUtils; @@ -68,38 +84,38 @@ public class OrchestrationUtil { public static final String ORCHESTRATION_CONFIG_NAMESPACE = "orchestration"; public static final String ORCHESTRATION_IMPL_KEY = "orchestration_impl"; - private NicDao nicDao; - private ComponentArtifactDao componentArtifactDao; - private ProcessDao processDao; - private OrchestrationTemplateDao orchestrationTemplateDataDao; - private ComponentDao componentDao; - private ServiceModelDao serviceModelDao; - private ComponentDependencyModelDao componentDependencyModelDao; - private CompositionEntityDataManager compositionEntityDataManager; - private CompositionDataExtractor compositionDataExtractor; + private final NicDao nicDao; + private final ComponentArtifactDao componentArtifactDao; + private final ProcessDao processDao; + private final OrchestrationTemplateDao orchestrationTemplateDataDao; + private final ComponentDao componentDao; + private final ServiceModelDao serviceModelDao; + private final ComponentDependencyModelDao componentDependencyModelDao; + private final CompositionEntityDataManager compositionEntityDataManager; + private final CompositionDataExtractor compositionDataExtractor; public OrchestrationUtil() { this(NicDaoFactory.getInstance().createInterface(), - MonitoringUploadDaoFactory.getInstance().createInterface(), - ProcessDaoFactory.getInstance().createInterface(), - OrchestrationTemplateDaoFactory.getInstance().createInterface(), - ComponentDaoFactory.getInstance().createInterface(), - ServiceModelDaoFactory.getInstance().createInterface(), - ComponentDependencyModelDaoFactory.getInstance().createInterface(), - CompositionEntityDataManagerFactory.getInstance().createInterface(), - CompositionDataExtractorFactory.getInstance().createInterface()); + MonitoringUploadDaoFactory.getInstance().createInterface(), + ProcessDaoFactory.getInstance().createInterface(), + OrchestrationTemplateDaoFactory.getInstance().createInterface(), + ComponentDaoFactory.getInstance().createInterface(), + ServiceModelDaoFactory.getInstance().createInterface(), + ComponentDependencyModelDaoFactory.getInstance().createInterface(), + CompositionEntityDataManagerFactory.getInstance().createInterface(), + CompositionDataExtractorFactory.getInstance().createInterface()); } - public OrchestrationUtil( - NicDao nicDao, - ComponentArtifactDao componentArtifactDao, - ProcessDao processDao, - OrchestrationTemplateDao orchestrationTemplateDataDao, - ComponentDao componentDao, - ServiceModelDao serviceModelDao, - ComponentDependencyModelDao componentDependencyModelDao, - CompositionEntityDataManager compositionEntityDataManager, - CompositionDataExtractor compositionDataExtractor) { + private OrchestrationUtil( + NicDao nicDao, + ComponentArtifactDao componentArtifactDao, + ProcessDao processDao, + OrchestrationTemplateDao orchestrationTemplateDataDao, + ComponentDao componentDao, + ServiceModelDao serviceModelDao, + ComponentDependencyModelDao componentDependencyModelDao, + CompositionEntityDataManager compositionEntityDataManager, + CompositionDataExtractor compositionDataExtractor) { this.nicDao = nicDao; this.componentArtifactDao = componentArtifactDao; this.processDao = processDao; @@ -140,26 +156,15 @@ public class OrchestrationUtil { Collection<ComponentEntity> componentsCompositionAndQuestionnaire = componentDao.listCompositionAndQuestionnaire(vspId, version); - componentsCompositionAndQuestionnaire.forEach(componentEntity -> - backupComponentQuestionnaire(vspId, version, componentEntity, componentsQustanniare, - componentNicsQustanniare, componentMibList, componentProcesses, 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(); - 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); + componentsCompositionAndQuestionnaire.forEach(componentEntity -> { + String componentName = componentEntity.getComponentCompositionData().getName(); + componentsQustanniare.put(componentName, componentEntity.getQuestionnaireData()); + backupMibData(vspId, version, componentEntity, componentName, componentMibList); + backupProcess(vspId, version, componentEntity.getId(), componentName, componentProcesses, + processArtifact); + backupNicsQuestionnaire(vspId, version, componentEntity, componentName, + componentNicsQustanniare); + }); } private void backupMibData(String vspId, Version version, ComponentEntity componentEntity, |