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.graph.exe;
23:
24: import java.io.*;
25:
26: import org.jbpm.graph.def.*;
27: import org.jbpm.util.EqualsUtil;
28:
29: /**
30: * is an action that can be added at runtime to the execution of one process instance.
31: */
32: public class RuntimeAction implements Serializable {
33:
34: private static final long serialVersionUID = 1L;
35:
36: long id = 0;
37: int version = 0;
38: protected ProcessInstance processInstance = null;
39: protected GraphElement graphElement = null;
40: protected String eventType = null;
41: protected Action action = null;
42:
43: public RuntimeAction() {
44: }
45:
46: /**
47: * creates a runtime action. Look up the event with {@link GraphElement#getEvent(String)}
48: * and the action with {@link ProcessDefinition#getAction(String)}. You can only
49: * lookup named actions easily.
50: */
51: public RuntimeAction(Event event, Action action) {
52: this .graphElement = event.getGraphElement();
53: this .eventType = event.getEventType();
54: this .action = action;
55: }
56:
57: public RuntimeAction(GraphElement graphElement, String eventType,
58: Action action) {
59: this .graphElement = graphElement;
60: this .eventType = eventType;
61: this .action = action;
62: }
63:
64: // equals ///////////////////////////////////////////////////////////////////
65: // hack to support comparing hibernate proxies against the real objects
66: // since this always falls back to ==, we don't need to overwrite the hashcode
67: public boolean equals(Object o) {
68: return EqualsUtil.equals(this , o);
69: }
70:
71: // getters and setters //////////////////////////////////////////////////////
72:
73: public long getId() {
74: return id;
75: }
76:
77: public ProcessInstance getProcessInstance() {
78: return processInstance;
79: }
80:
81: public Action getAction() {
82: return action;
83: }
84:
85: public String getEventType() {
86: return eventType;
87: }
88:
89: public GraphElement getGraphElement() {
90: return graphElement;
91: }
92: }
|