01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.spi.hibernate;
06:
07: import com.opensymphony.workflow.StoreException;
08: import com.opensymphony.workflow.util.PropertySetDelegate;
09:
10: import net.sf.hibernate.HibernateException;
11: import net.sf.hibernate.Session;
12:
13: import java.util.Map;
14:
15: /**
16: * @author masini
17: *
18: * New Refactored Hibernate Store.
19: * Look at @link NewHibernateFunctionalWorkflowTestCase for a use case.
20: */
21: public class NewHibernateWorkflowStore extends
22: AbstractHibernateWorkflowStore {
23: //~ Instance fields ////////////////////////////////////////////////////////
24:
25: Session session;
26:
27: //~ Constructors ///////////////////////////////////////////////////////////
28:
29: public NewHibernateWorkflowStore() {
30: super ();
31: }
32:
33: //~ Methods ////////////////////////////////////////////////////////////////
34:
35: // Now session management is delegated to user
36: public void init(Map props) throws StoreException {
37: session = (Session) props.get("session");
38:
39: setPropertySetDelegate((PropertySetDelegate) props
40: .get("propertySetDelegate"));
41: }
42:
43: protected Object execute(InternalCallback action)
44: throws StoreException {
45: try {
46: return action.doInHibernate(session);
47: } catch (HibernateException e) {
48: throw new StoreException(e);
49: }
50: }
51: }
|