]>
git.argeo.org Git - gpl/argeo-slc.git/blob - structure/tree/TreeSPathDaoHibernate.java
1 package org
.argeo
.slc
.hibernate
.structure
.tree
;
5 import org
.springframework
.orm
.hibernate3
.support
.HibernateDaoSupport
;
7 import org
.apache
.commons
.logging
.Log
;
8 import org
.apache
.commons
.logging
.LogFactory
;
10 import org
.argeo
.slc
.core
.structure
.tree
.TreeSPath
;
11 import org
.argeo
.slc
.dao
.structure
.tree
.TreeSPathDao
;
14 * The Hibernate implementation for tree-based result of the test result dao.
18 public class TreeSPathDaoHibernate
extends HibernateDaoSupport
implements
21 private static Log log
= LogFactory
.getLog(TreeSPathDaoHibernate
.class);
23 public void create(TreeSPath path
) {
27 private void createImpl(TreeSPath path
) {
28 if (path
.getParent() != null) {
29 TreeSPath parent
= getTreeSPath(path
.getParent()
30 .getAsUniqueString());
32 createImpl(path
.getParent());
35 getHibernateTemplate().save(path
);
36 if (log
.isTraceEnabled())
37 log
.trace("Saved TreeSPath " + path
.getAsUniqueString());
40 public TreeSPath
getTreeSPath(String pathString
) {
41 List
<?
> list
= getHibernateTemplate().find(
42 "from TreeSPath where asUniqueString=?", pathString
);
43 if (list
.size() == 0) {
46 return (TreeSPath
) list
.get(0);
50 public TreeSPath
getOrCreate(TreeSPath pathTransient
) {
51 TreeSPath path
= getTreeSPath(pathTransient
.getAsUniqueString());
55 create(pathTransient
);
57 return getTreeSPath(pathTransient
.getAsUniqueString());