Repository: ambari Updated Branches: refs/heads/trunk 1862126a0 -> 8b535db8b
AMBARI-11820. Deleting a shared widget still available on the dashboard of another user. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8b535db8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8b535db8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8b535db8 Branch: refs/heads/trunk Commit: 8b535db8bd50c05534b765c252d3bc0521640d71 Parents: 1862126 Author: Siddharth Wagle <swa...@hortonworks.com> Authored: Tue Jun 9 13:20:19 2015 -0700 Committer: Siddharth Wagle <swa...@hortonworks.com> Committed: Tue Jun 9 13:20:26 2015 -0700 ---------------------------------------------------------------------- .../controller/internal/WidgetLayoutResourceProvider.java | 7 +++++++ .../server/controller/internal/WidgetResourceProvider.java | 8 ++++++++ 2 files changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8b535db8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java index 7bee12c..67ccafd 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java @@ -355,6 +355,13 @@ public class WidgetLayoutResourceProvider extends AbstractControllerResourceProv } for (WidgetLayoutEntity entity: entitiesToBeRemoved) { + if (entity.getListWidgetLayoutUserWidgetEntity() != null) { + for (WidgetLayoutUserWidgetEntity layoutUserWidgetEntity : entity.getListWidgetLayoutUserWidgetEntity()) { + if (layoutUserWidgetEntity.getWidget().getListWidgetLayoutUserWidgetEntity() != null) { + layoutUserWidgetEntity.getWidget().getListWidgetLayoutUserWidgetEntity().remove(layoutUserWidgetEntity); + } + } + } widgetLayoutDAO.remove(entity); } http://git-wip-us.apache.org/repos/asf/ambari/blob/8b535db8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java index 64bb94c..897d7e8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java @@ -37,6 +37,7 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper; import org.apache.ambari.server.orm.dao.WidgetDAO; import org.apache.ambari.server.orm.entities.PermissionEntity; import org.apache.ambari.server.orm.entities.WidgetEntity; +import org.apache.ambari.server.orm.entities.WidgetLayoutUserWidgetEntity; import org.apache.ambari.server.security.authorization.AmbariGrantedAuthority; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; @@ -346,6 +347,13 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider { } for (WidgetEntity entity: entitiesToBeRemoved) { + if (entity.getListWidgetLayoutUserWidgetEntity() != null) { + for (WidgetLayoutUserWidgetEntity layoutUserWidgetEntity : entity.getListWidgetLayoutUserWidgetEntity()) { + if (layoutUserWidgetEntity.getWidgetLayout().getListWidgetLayoutUserWidgetEntity() != null) { + layoutUserWidgetEntity.getWidgetLayout().getListWidgetLayoutUserWidgetEntity().remove(layoutUserWidgetEntity); + } + } + } widgetDAO.remove(entity); }