01: /*
02: * JBoss, Home of Professional Open Source
03: * Copyright 2005, JBoss Inc., and individual contributors as indicated
04: * by the @authors tag. See the copyright.txt in the distribution for a
05: * full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jbpm.module.exe;
23:
24: import java.io.Serializable;
25:
26: import org.jbpm.JbpmContext;
27: import org.jbpm.graph.exe.ProcessInstance;
28: import org.jbpm.svc.Service;
29: import org.jbpm.util.EqualsUtil;
30:
31: public class ModuleInstance implements Serializable {
32:
33: private static final long serialVersionUID = 1L;
34:
35: long id = 0;
36: int version = 0;
37: protected ProcessInstance processInstance = null;
38:
39: public ModuleInstance() {
40: }
41:
42: // equals ///////////////////////////////////////////////////////////////////
43: // hack to support comparing hibernate proxies against the real objects
44: // since this always falls back to ==, we don't need to overwrite the hashcode
45: public boolean equals(Object o) {
46: return EqualsUtil.equals(this , o);
47: }
48:
49: protected Service getService(String serviceName) {
50: Service service = null;
51: JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
52: if (jbpmContext != null) {
53: service = jbpmContext.getServices().getService(serviceName);
54: }
55: return service;
56: }
57:
58: // getters and setters //////////////////////////////////////////////////////
59:
60: public long getId() {
61: return id;
62: }
63:
64: public ProcessInstance getProcessInstance() {
65: return processInstance;
66: }
67:
68: public void setProcessInstance(ProcessInstance processInstance) {
69: this.processInstance = processInstance;
70: }
71: }
|