From 2d2e0b503f915a81ae9a02dfa3afac3de369efde Mon Sep 17 00:00:00 2001 From: sheetalm Date: Thu, 8 Feb 2018 09:30:02 +0530 Subject: Onboarding foundation changes 1. Adding OnboardingSessionContextFilter which sets tenant(kespace) for onboarding application 2. Different services can extend SessionContextFilter to set their own keyspace 3. These changes in onboarding are done to support services like ActivitySpec Change-Id: Ia62557354ab05235d027250af94a2835d741b7fa Issue-ID: SDC-1005 Signed-off-by: sheetalm --- .../sdc/healing/impl/HealingManagerImpl.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core') diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java index 9db9ea44b8..07122f093e 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java @@ -23,7 +23,10 @@ package org.openecomp.sdc.healing.impl; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.Messages; +import org.openecomp.sdc.common.session.SessionContext; import org.openecomp.sdc.common.session.SessionContextProviderFactory; import org.openecomp.sdc.datatypes.model.ItemType; import org.openecomp.sdc.healing.api.HealingManager; @@ -98,8 +101,9 @@ public class HealingManagerImpl implements HealingManager { : Optional.empty(); if (privateFailureMessages.isPresent() || publicFailureMessages.isPresent()) { - throw new RuntimeException( - publicFailureMessages.orElse("") + " " + privateFailureMessages.orElse("")); + throw new CoreException(new ErrorCode.ErrorCodeBuilder().withMessage( + publicFailureMessages.orElse("") + " " + privateFailureMessages.orElse("")) + .build()); } } @@ -126,8 +130,10 @@ public class HealingManagerImpl implements HealingManager { private Optional healPublic(String itemId, Version version, Map> itemHealers, String user) { - SessionContextProviderFactory.getInstance().createInterface() - .create(user + HEALING_USER_SUFFIX); + SessionContext context = + SessionContextProviderFactory.getInstance().createInterface().get(); + SessionContextProviderFactory.getInstance().createInterface().create(user + + HEALING_USER_SUFFIX,context.getTenant()); versioningManager.sync(itemId, version); @@ -138,7 +144,7 @@ public class HealingManagerImpl implements HealingManager { versioningManager.publish(itemId, version, "Healing vsp"); } - SessionContextProviderFactory.getInstance().createInterface().create(user); + SessionContextProviderFactory.getInstance().createInterface().create(user, context.getTenant()); return healingFailureMessages; } @@ -161,7 +167,8 @@ public class HealingManagerImpl implements HealingManager { Object result = executeHealer(itemId, version, healerClassName, healingFailureMessages); if (!healingFailureMessages.isEmpty()) { - throw new RuntimeException(CommonMethods.listToSeparatedString(healingFailureMessages, '\n')); + throw new CoreException(new ErrorCode.ErrorCodeBuilder().withMessage(CommonMethods + .listToSeparatedString(healingFailureMessages, '\n')).build()); } return result; } @@ -223,8 +230,6 @@ public class HealingManagerImpl implements HealingManager { } private Map> getItemHealers(ItemType itemType) { - // TODO: 11/29/2017 create objects to hold this configuration + - // load once from the json file and use the relevant healers (by itemType, healerType) as needed. Map healingConfig = FileUtils .readViaInputStream(HEALERS_BY_ENTITY_TYPE_FILE, stream -> JsonUtil.json2Object(stream, Map.class)); -- cgit 1.2.3-korg