Clean up dependencies on map delete
parent
599bc9ec00
commit
5f26874b47
|
@ -227,15 +227,18 @@ public class MindmapManagerImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMindmap(@NotNull final Mindmap mindMap) {
|
public void removeMindmap(@NotNull final Mindmap mindmap) {
|
||||||
// Delete history first ...
|
// Delete history first ...
|
||||||
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
|
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
|
||||||
hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId()));
|
hibernateCriteria.add(Restrictions.eq("mindmapId", mindmap.getId()));
|
||||||
List list = hibernateCriteria.list();
|
final List list = hibernateCriteria.list();
|
||||||
getHibernateTemplate().deleteAll(list);
|
getHibernateTemplate().deleteAll(list);
|
||||||
|
|
||||||
|
// Remove collaborations ...
|
||||||
|
mindmap.removedCollaboration(mindmap.getCollaborations());
|
||||||
|
|
||||||
// Delete mindmap ....
|
// Delete mindmap ....
|
||||||
getHibernateTemplate().delete(mindMap);
|
getHibernateTemplate().delete(mindmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveHistory(@NotNull final Mindmap mindMap) {
|
private void saveHistory(@NotNull final Mindmap mindMap) {
|
||||||
|
|
|
@ -146,7 +146,11 @@ public class Mindmap implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removedCollaboration(@NotNull Collaboration collaboration) {
|
public void removedCollaboration(@NotNull Collaboration collaboration) {
|
||||||
collaborations.add(collaboration);
|
collaborations.remove(collaboration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removedCollaboration(@NotNull Set<Collaboration> collaborations) {
|
||||||
|
this.collaborations.removeAll(collaborations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -182,7 +186,7 @@ public class Mindmap implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCreator(@NotNull User user) {
|
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() {
|
public boolean isPublic() {
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class AccountController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete labels ....
|
// Delete labels ....
|
||||||
List<Label> labels = labelService.getAll(user);
|
final List<Label> labels = labelService.getAll(user);
|
||||||
labels.forEach(l -> {
|
labels.forEach(l -> {
|
||||||
try {
|
try {
|
||||||
labelService.removeLabel(l, user);
|
labelService.removeLabel(l, user);
|
||||||
|
|
Loading…
Reference in New Issue