summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core')
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java62
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json3
2 files changed, 33 insertions, 32 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 eef8c3cd44..c13e89cb76 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
@@ -65,39 +65,39 @@ public class HealingManagerImpl implements HealingManager {
public Optional<Version> healItemVersion(final String itemId, final Version version,
final ItemType itemType, final boolean force) {
String user = getUser();
- if (force || isPrivateHealingNeededByFlag(itemId, version.getId(), user)) {
-
- Map<String, Collection<String>> healersByType = getItemHealers(itemType);
- List<String> failureMessages = new LinkedList<>();
- List<Healer> structureHealersToRun =
- getHealersToRun(healersByType.get(HealerType.structure.name()), itemId, version,
- failureMessages);
- List<Healer> dataHealersToRun =
- getHealersToRun(healersByType.get(HealerType.data.name()), itemId, version,
- failureMessages);
-
- if (structureHealersToRun.isEmpty() && dataHealersToRun.isEmpty()) {
- markAsHealed(itemId, version.getId(), user);
- markAsHealed(itemId, version.getId(), PUBLIC_USER);
- return Optional.empty();
- }
-
- Optional<Version> healVersion = getHealVersion(itemId, version);
- if (!healVersion.isPresent()) {
- // do NOT turn off flag here (in thought of saving version calculate performance next
- // time) because maybe next time the next version will be available (due to deletion of
- // the taken one)
- return Optional.empty();
- }
+ if (!force && !isPrivateHealingNeededByFlags(itemId, version.getId(), user)) {
+ return Optional.empty();
+ }
- failureMessages.addAll(
- doHeal(itemId, healVersion.get(), version, structureHealersToRun, dataHealersToRun, user,
- force));
+ Map<String, Collection<String>> healersByType = getItemHealers(itemType);
+ List<String> failureMessages = new LinkedList<>();
+ List<Healer> structureHealersToRun =
+ getHealersToRun(healersByType.get(HealerType.structure.name()), itemId, version,
+ failureMessages);
+ List<Healer> dataHealersToRun =
+ getHealersToRun(healersByType.get(HealerType.data.name()), itemId, version,
+ failureMessages);
+
+ if (structureHealersToRun.isEmpty() && dataHealersToRun.isEmpty()) {
+ markAsHealed(itemId, version.getId(), user);
+ markAsHealed(itemId, version.getId(), PUBLIC_USER);
+ return Optional.empty();
+ }
- handleFailures(failureMessages);
- return healVersion;
+ Optional<Version> healVersion = getHealVersion(itemId, version);
+ if (!healVersion.isPresent()) {
+ // do NOT turn off flag here (in thought of saving version calculate performance next
+ // time) because maybe next time the next version will be available (due to deletion of
+ // the taken one)
+ return Optional.empty();
}
- return Optional.empty();
+
+ failureMessages.addAll(
+ doHeal(itemId, healVersion.get(), version, structureHealersToRun, dataHealersToRun, user,
+ force));
+ handleFailures(failureMessages);
+
+ return healVersion;
}
private Optional<Version> getHealVersion(String itemId, Version version) {
@@ -200,7 +200,7 @@ public class HealingManagerImpl implements HealingManager {
return failureMessages;
}
- private boolean isPrivateHealingNeededByFlag(String itemId, String version, String user) {
+ private boolean isPrivateHealingNeededByFlags(String itemId, String version, String user) {
Optional<Boolean> userHealingFlag = getHealingFlag(itemId, version, user);
return userHealingFlag.orElseGet(() -> isPublicHealingNeededByFlag(itemId, version));
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
index 2fc23372de..51de9d0802 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
@@ -1,7 +1,8 @@
{
"vsp": {
"structure": [
- "org.openecomp.sdc.healing.healers.OwnerHealer"
+ "org.openecomp.sdc.healing.healers.OwnerHealer",
+ "org.openecomp.sdc.healing.healers.NetworkPackageHealer"
],
"data": [
"org.openecomp.sdc.healing.healers.ToscaServiceModelHealer"