summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-healing-lib
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-02-08 09:30:02 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-02-08 12:38:37 +0000
commit2d2e0b503f915a81ae9a02dfa3afac3de369efde (patch)
treeb05555ebaca90f1d620f4562067bf486731ee48c /openecomp-be/lib/openecomp-healing-lib
parent89f96b17aed5c432be3df6d75a49a1f9ebc9120b (diff)
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 <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-healing-lib')
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java21
1 files changed, 13 insertions, 8 deletions
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<String> healPublic(String itemId, Version version,
Map<String, Map<String, String>> 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<String, Map<String, String>> 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));