001: /*
002: * $Id: Event.java,v 1.6 2004/12/09 12:34:49 kowap Exp $
003: *
004: * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
005: * Berne University of Applied Sciences
006: * School of Engineering and Information Technology
007: * All rights reserved.
008: */
009: package bexee.event;
010:
011: import java.util.HashMap;
012: import java.util.Map;
013:
014: import bexee.model.activity.Activity;
015: import bexee.model.elements.Variable;
016:
017: /**
018: * In bexee, all BPEL process instances are represented with a
019: * <code>ProcessContext</code>. The instances of <code>ProcessContext</code>
020: * s contain <code>Event</code> s which are used for the representation of
021: * actually Activities.
022: *
023: * @version $Revision: 1.6 $, $Date: 2004/12/09 12:34:49 $
024: * @author Patric Fornasier
025: * @author Pawel Kowalski
026: */
027: public class Event {
028:
029: public static final int WAITING = 0;
030:
031: public static final int DONE = 1;
032:
033: private Activity activity;
034:
035: private int state;
036:
037: private Map variables;
038:
039: /**
040: * Create a new <code>Event</code> instance with a given
041: * <code>Activity</code>. The given <code>Activity</code> is an
042: * immutable property of an <code>Event</code>.
043: *
044: * @param activity
045: * The <code>Activity</code> associated with this
046: * <code>Event</code>
047: */
048: public Event(Activity activity) {
049: variables = new HashMap();
050: this .activity = activity;
051: }
052:
053: /**
054: * Set the state of this <code>Event</code>.
055: *
056: * @param state
057: */
058: public void setState(int state) {
059: this .state = state;
060: }
061:
062: /**
063: * Get the current state of this <code>Event</code>.
064: *
065: * @return the current state.
066: */
067: public int getState() {
068: return state;
069: }
070:
071: /**
072: * Add a variable value to this <code>Event</code>.
073: *
074: * @param variable
075: * a <code>Variable</code> instance used as a variable
076: * identifier.
077: * @param value
078: * the variable value.
079: */
080: public void putValue(Variable variable, Object value) {
081: variables.put(variable, value);
082: }
083:
084: /**
085: * Get a variable value from this <code>Event</code>.
086: *
087: * @param variable
088: * the variable identifier.
089: * @return the variable value.
090: */
091: public Object getValue(Variable variable) {
092: return variables.get(variable);
093: }
094:
095: /**
096: * Get the <code>Activity</code> associated with this <code>Event</code>.
097: *
098: * @return the Activity associated with this <code>Event</code>.
099: */
100: public Activity getActivity() {
101: return activity;
102: }
103:
104: }
|