aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorayalaben <Ayala.Benzvi@Amdocs.Com>2017-12-31 17:57:36 +0200
committerayalaben <ayala.benzvi@amdocs.com>2017-12-31 17:57:36 +0200
commitac7c685240c6cfa34a6e6afa86e602954b9a8047 (patch)
tree7e1f77bd4f0f2745ff0282a79a36ca3244ea2b2a /openecomp-be
parentfa79ba2e1b23504e07f1fa8019050594ac7dfdf0 (diff)
Fix Owner Healer
Change-Id: I85371b7cd6e2fa6e929b42b4773eef685252bcff Issue-ID: SDC-837 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml5
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/OwnerHealer.java24
2 files changed, 29 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml
index 32975b3ebf..550b4e610f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml
@@ -176,6 +176,11 @@
<artifactId>togglz-servlet</artifactId>
<version>${togglz.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-console</artifactId>
+ <version>${togglz.version}</version>
+ </dependency>
</dependencies>
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/OwnerHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/OwnerHealer.java
index acc20c97e4..b9fc33f47a 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/OwnerHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/OwnerHealer.java
@@ -7,11 +7,17 @@ import org.openecomp.sdc.itempermissions.dao.ItemPermissionsDaoFactory;
import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes;
import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.notification.dao.SubscribersDao;
+import org.openecomp.sdc.notification.factories.SubscribersDaoFactory;
+import org.openecomp.sdc.versioning.dao.ItemDao;
+import org.openecomp.sdc.versioning.dao.ItemDaoFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.Item;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Objects;
/**
* Created by ayalaben on 8/28/2017
@@ -22,6 +28,10 @@ public class OwnerHealer implements Healer {
private static final ItemPermissionsDao permissionsDao =
ItemPermissionsDaoFactory.getInstance().createInterface();
+ private static final ItemDao itemDao = ItemDaoFactory.getInstance().createInterface();
+
+ private static final SubscribersDao subscribersDao = SubscribersDaoFactory.getInstance()
+ .createInterface();
public Object heal(String itemId, Version version) {
mdcDataDebugMessage.debugEntryMessage(null);
@@ -36,11 +46,25 @@ public class OwnerHealer implements Healer {
permissionsDao.updateItemPermissions(itemId, PermissionTypes.Owner.name(),
Collections.singleton(currentUserId), new HashSet<>());
+ updateItemOwner(itemId,currentUserId);
+
+ subscribersDao.subscribe(currentUserId,itemId);
+
return currentUserId;
}
return itemPermissions.stream().filter(this::isOwnerPermission).findFirst().get().getUserId();
}
+ private void updateItemOwner(String itemId,String userId) {
+ Item item = new Item();
+ item.setId(itemId);
+ Item retrievedItem = itemDao.get(item);
+ if (Objects.nonNull(retrievedItem)) {
+ retrievedItem.setOwner(userId);
+ itemDao.update(retrievedItem);
+ }
+ }
+
private boolean isOwnerPermission(ItemPermissionsEntity permissionsEntity) {
return permissionsEntity.getPermission().equals(PermissionTypes.Owner.name());
}