View Javadoc

1   /*
2    * $Id: Event.java,v 1.1 2004/12/15 14:18:22 patforna Exp $
3    *
4    * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
5    * Berne University of Applied Sciences
6    * School of Engineering and Information Technology
7    * All rights reserved.
8    */
9   package bexee.event;
10  
11  import java.util.HashMap;
12  import java.util.Map;
13  
14  import bexee.model.activity.Activity;
15  import bexee.model.elements.Variable;
16  
17  /***
18   * In bexee, all BPEL process instances are represented with a
19   * <code>ProcessContext</code>. The instances of <code>ProcessContext</code>
20   * s contain <code>Event</code> s which are used for the representation of
21   * actually Activities.
22   * 
23   * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:22 $
24   * @author Patric Fornasier
25   * @author Pawel Kowalski
26   */
27  public class Event {
28  
29      public static final int WAITING = 0;
30  
31      public static final int DONE = 1;
32  
33      private Activity activity;
34  
35      private int state;
36  
37      private Map variables;
38  
39      /***
40       * Create a new <code>Event</code> instance with a given
41       * <code>Activity</code>. The given <code>Activity</code> is an
42       * immutable property of an <code>Event</code>.
43       * 
44       * @param activity
45       *            The <code>Activity</code> associated with this
46       *            <code>Event</code>
47       */
48      public Event(Activity activity) {
49          variables = new HashMap();
50          this.activity = activity;
51      }
52  
53      /***
54       * Set the state of this <code>Event</code>.
55       * 
56       * @param state
57       */
58      public void setState(int state) {
59          this.state = state;
60      }
61  
62      /***
63       * Get the current state of this <code>Event</code>.
64       * 
65       * @return the current state.
66       */
67      public int getState() {
68          return state;
69      }
70  
71      /***
72       * Add a variable value to this <code>Event</code>.
73       * 
74       * @param variable
75       *            a <code>Variable</code> instance used as a variable
76       *            identifier.
77       * @param value
78       *            the variable value.
79       */
80      public void putValue(Variable variable, Object value) {
81          variables.put(variable, value);
82      }
83  
84      /***
85       * Get a variable value from this <code>Event</code>.
86       * 
87       * @param variable
88       *            the variable identifier.
89       * @return the variable value.
90       */
91      public Object getValue(Variable variable) {
92          return variables.get(variable);
93      }
94  
95      /***
96       * Get the <code>Activity</code> associated with this <code>Event</code>.
97       * 
98       * @return the Activity associated with this <code>Event</code>.
99       */
100     public Activity getActivity() {
101         return activity;
102     }
103 
104 }