diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java index 698b6a3b..ce465a38 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java @@ -227,15 +227,18 @@ public class MindmapManagerImpl } @Override - public void removeMindmap(@NotNull final Mindmap mindMap) { + public void removeMindmap(@NotNull final Mindmap mindmap) { // Delete history first ... final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class); - hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId())); - List list = hibernateCriteria.list(); + hibernateCriteria.add(Restrictions.eq("mindmapId", mindmap.getId())); + final List list = hibernateCriteria.list(); getHibernateTemplate().deleteAll(list); + // Remove collaborations ... + mindmap.removedCollaboration(mindmap.getCollaborations()); + // Delete mindmap .... - getHibernateTemplate().delete(mindMap); + getHibernateTemplate().delete(mindmap); } private void saveHistory(@NotNull final Mindmap mindMap) { diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java index 22bf1d6f..d3cdf366 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java @@ -146,7 +146,11 @@ public class Mindmap implements Serializable { } public void removedCollaboration(@NotNull Collaboration collaboration) { - collaborations.add(collaboration); + collaborations.remove(collaboration); + } + + public void removedCollaboration(@NotNull Set collaborations) { + this.collaborations.removeAll(collaborations); } @NotNull @@ -182,7 +186,7 @@ public class Mindmap implements Serializable { } public boolean isCreator(@NotNull User user) { - return this.getCreator()!=null && this.getCreator().identityEquality(user); + return this.getCreator() != null && this.getCreator().identityEquality(user); } public boolean isPublic() { diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java index b9f6d93c..d6f0921b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java @@ -129,7 +129,7 @@ public class AccountController extends BaseController { } // Delete labels .... - List