- public UUID delete(PolytomousKeyNode node, boolean deleteChildren){\r
- UUID uuid = node.getUuid();\r
- node = (PolytomousKeyNode)HibernateProxyHelper.deproxy(node);\r
- List<PolytomousKeyNode> children = node.getChildren();\r
+ public DeleteResult delete(UUID nodeUUID, boolean deleteChildren){\r
+ DeleteResult result = new DeleteResult();\r
+ PolytomousKeyNode node = dao.findByUuid(nodeUUID);\r
+ node = (PolytomousKeyNode)HibernateProxyHelper.deproxy(node);\r
+ if(node == null) {\r
+ return null;\r
+ }\r
+ List<PolytomousKeyNode> children = new ArrayList<PolytomousKeyNode>();\r
+ for (PolytomousKeyNode child: node.getChildren()){\r
+ children.add(child);\r
+ }\r
+ PolytomousKeyNode parent = node.getParent();\r
+ parent = HibernateProxyHelper.deproxy(parent, PolytomousKeyNode.class);\r