Anonymous avatar Anonymous committed e03cdd7

PropertySetDelegate supporting hibernate3, which is now available in PropertySet 1.5.

Comments (0)

Files changed (1)

src/java/com/opensymphony/workflow/spi/hibernate3/DefaultHibernatePropertySetDelegate.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+
+/**
+ * Copyright 2008 Tribune Company All rights reserved.
+ * TRIBUNE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+package com.opensymphony.workflow.spi.hibernate3;
+
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.module.propertyset.hibernate3.DefaultHibernateConfigurationProvider;
+import com.opensymphony.module.propertyset.hibernate3.HibernatePropertySet;
+
+import com.opensymphony.workflow.util.PropertySetDelegate;
+
+import org.hibernate.SessionFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * DOCUMENTME
+ * @author $author$
+ * @version $Revision: 1.1 $
+ *
+ */
+public class DefaultHibernatePropertySetDelegate implements PropertySetDelegate {
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    // ~ Instance fields
+    // ////////////////////////////////////////////////////////
+    private SessionFactory sessionFactory;
+
+    //~ Constructors ///////////////////////////////////////////////////////////
+
+    // ~ Constructors
+    // ///////////////////////////////////////////////////////////
+    public DefaultHibernatePropertySetDelegate() {
+        super();
+    }
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    // ~ Methods
+    // ////////////////////////////////////////////////////////////////
+    public PropertySet getPropertySet(long entryId) {
+        HashMap args = new HashMap();
+        args.put("entityName", "OSWorkflowEntry");
+        args.put("entityId", new Long(entryId));
+
+        DefaultHibernateConfigurationProvider configurationProvider = new DefaultHibernateConfigurationProvider();
+        configurationProvider.setSessionFactory(getSessionFactory());
+
+        args.put("configurationProvider", configurationProvider);
+
+        Map config = new HashMap();
+        PropertySet properties = new HibernatePropertySet();
+        properties.init(config, args);
+
+        return properties;
+    }
+
+    public void setSessionFactory(SessionFactory sessionFactory) {
+        this.sessionFactory = sessionFactory;
+    }
+
+    private SessionFactory getSessionFactory() {
+        return sessionFactory;
+    }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.