Clean up dependencies on map delete
parent
599bc9ec00
commit
5f26874b47
|
@ -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) {
|
||||
|
|
|
@ -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<Collaboration> 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() {
|
||||
|
|
|
@ -129,7 +129,7 @@ public class AccountController extends BaseController {
|
|||
}
|
||||
|
||||
// Delete labels ....
|
||||
List<Label> labels = labelService.getAll(user);
|
||||
final List<Label> labels = labelService.getAll(user);
|
||||
labels.forEach(l -> {
|
||||
try {
|
||||
labelService.removeLabel(l, user);
|
||||
|
|
Loading…
Reference in New Issue