01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: /*
06: * Created on 20-ott-2005
07: *
08: * To change the template for this generated file go to
09: * Window - Preferences - Java - Code Generation - Code and Comments
10: */
11: package com.opensymphony.workflow.spi.hibernate;
12:
13: import com.opensymphony.module.propertyset.PropertySet;
14: import com.opensymphony.module.propertyset.PropertySetManager;
15: import com.opensymphony.module.propertyset.hibernate.DefaultHibernateConfigurationProvider;
16:
17: import com.opensymphony.workflow.util.PropertySetDelegate;
18:
19: import net.sf.hibernate.SessionFactory;
20:
21: import java.util.HashMap;
22:
23: /**
24: * DOCUMENT ME!
25: *
26: * @author $author$
27: * @version $Revision$
28: */
29: public class DefaultHibernatePropertySetDelegate implements
30: PropertySetDelegate {
31: //~ Instance fields ////////////////////////////////////////////////////////
32:
33: private SessionFactory sessionFactory;
34:
35: //~ Constructors ///////////////////////////////////////////////////////////
36:
37: public DefaultHibernatePropertySetDelegate() {
38: super ();
39: }
40:
41: //~ Methods ////////////////////////////////////////////////////////////////
42:
43: public PropertySet getPropertySet(long entryId) {
44: HashMap args = new HashMap();
45: args.put("entityName", "OSWorkflowEntry");
46: args.put("entityId", new Long(entryId));
47:
48: DefaultHibernateConfigurationProvider configurationProvider = new DefaultHibernateConfigurationProvider();
49: configurationProvider.setSessionFactory(getSessionFactory());
50:
51: args.put("configurationProvider", configurationProvider);
52:
53: return PropertySetManager.getInstance("hibernate", args);
54: }
55:
56: public void setSessionFactory(SessionFactory sessionFactory) {
57: this .sessionFactory = sessionFactory;
58: }
59:
60: private SessionFactory getSessionFactory() {
61: return sessionFactory;
62: }
63: }
|