import org.hibernate.Session;\r
import org.springframework.orm.hibernate3.HibernateCallback;\r
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
+import org.springframework.util.Assert;\r
\r
/**\r
* The Hibernate implementation for tree-based result of the test result dao.\r
throws HibernateException, SQLException {\r
TreeTestResult treeTestResult = getTreeTestResult(session,\r
testResultId);\r
+\r
+ // Check is there is already such an attachment\r
+ Assert.notNull(attachment, "attachment is null");\r
+ Assert.notNull(session, "session is null");\r
+ SimpleAttachment att = (SimpleAttachment) session.get(\r
+ attachment.getClass(), attachment.getUuid());\r
+ if (att != null)\r
+ throw new SlcException(\r
+ "There is already an attachement with id "\r
+ + attachment.getUuid());\r
+\r
treeTestResult.getAttachments().add(attachment);\r
session.update(treeTestResult);\r
return treeTestResult;\r