1 package org
.argeo
.slc
.hibernate
.process
;
3 import java
.sql
.SQLException
;
6 import org
.springframework
.orm
.hibernate3
.HibernateCallback
;
7 import org
.springframework
.orm
.hibernate3
.support
.HibernateDaoSupport
;
9 import org
.argeo
.slc
.core
.SlcException
;
10 import org
.argeo
.slc
.core
.process
.SlcExecution
;
11 import org
.argeo
.slc
.core
.process
.SlcExecutionStep
;
12 import org
.argeo
.slc
.dao
.process
.SlcExecutionDao
;
13 import org
.hibernate
.HibernateException
;
14 import org
.hibernate
.Session
;
16 public class SlcExecutionDaoHibernate
extends HibernateDaoSupport
implements
19 public void create(SlcExecution slcExecution
) {
20 getHibernateTemplate().save(slcExecution
);
23 public void update(final SlcExecution slcExecution
) {
24 getHibernateTemplate().update(slcExecution
);
27 public void merge(final SlcExecution slcExecution
) {
28 getHibernateTemplate().merge(slcExecution
);
31 public SlcExecution
getSlcExecution(String uuid
) {
32 return (SlcExecution
) getHibernateTemplate().get(SlcExecution
.class,
36 public List
<SlcExecution
> listSlcExecutions() {
37 return (List
<SlcExecution
>) getHibernateTemplate().loadAll(
41 public void addSteps(final String slcExecutionId
,
42 final List
<SlcExecutionStep
> additionalSteps
) {
43 getHibernateTemplate().execute(new HibernateCallback() {
45 public Object
doInHibernate(Session session
)
46 throws HibernateException
, SQLException
{
47 SlcExecution slcExecution
= (SlcExecution
) session
.get(
48 SlcExecution
.class, slcExecutionId
);
50 if (slcExecution
== null)
51 throw new SlcException("Could not find SLC execution "
54 slcExecution
.getSteps().addAll(additionalSteps
);
55 session
.update(slcExecution
);