diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java index e0fb64325c..626db53d91 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java @@ -21,6 +21,11 @@ */ package org.openecomp.sdc.be.components.merge.instance; +import static org.apache.commons.collections.MapUtils.isEmpty; + +import java.util.List; +import java.util.Map; +import java.util.Optional; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Component; @@ -28,12 +33,6 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import static org.apache.commons.collections.MapUtils.isEmpty; - @org.springframework.stereotype.Component public class ExternalRefsMergeBL implements ComponentInstanceMergeInterface { @@ -44,10 +43,10 @@ public class ExternalRefsMergeBL implements ComponentInstanceMergeInterface { } @Override - public void saveDataBeforeMerge(DataForMergeHolder dataHolder, Component containerComponent, - ComponentInstance currentResourceInstance, Component originComponent) { - Map<String, List<String>> externalRefs = externalReferencesOperation.getAllExternalReferences(containerComponent.getUniqueId(), - currentResourceInstance.getUniqueId()); + public void saveDataBeforeMerge(DataForMergeHolder dataHolder, Component containerComponent, ComponentInstance currentResourceInstance, + Component originComponent) { + Map<String, List<String>> externalRefs = externalReferencesOperation + .getAllExternalReferences(containerComponent.getUniqueId(), currentResourceInstance.getUniqueId()); dataHolder.setOrigComponentInstanceExternalRefs(externalRefs); } @@ -55,13 +54,12 @@ public class ExternalRefsMergeBL implements ComponentInstanceMergeInterface { public Component mergeDataAfterCreate(User user, DataForMergeHolder dataHolder, Component updatedContainerComponent, String newInstanceId) { Optional<ComponentInstance> componentInstance = updatedContainerComponent.getComponentInstanceById(newInstanceId); if (!componentInstance.isPresent()) { - throw new ByActionStatusComponentException(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND, - newInstanceId); + throw new ByActionStatusComponentException(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND, newInstanceId); } - Map<String, List<String>> savedExternalRefs = dataHolder.getOrigCompInstExternalRefs(); + Map<String, List<String>> savedExternalRefs = dataHolder.getOrigCompInstExternalRefs(); if (!isEmpty(savedExternalRefs)) { - externalReferencesOperation.addAllExternalReferences(updatedContainerComponent.getUniqueId(), - componentInstance.get().getUniqueId(), savedExternalRefs); + externalReferencesOperation + .addAllExternalReferences(updatedContainerComponent.getUniqueId(), componentInstance.get().getUniqueId(), savedExternalRefs); } return updatedContainerComponent; } |