KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > workflow > impl > BooleanVariableAssignmentImpl


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: BooleanVariableAssignmentImpl.java 42837 2004-04-13 22:04:35Z joerg $ */
19
20 package org.apache.lenya.workflow.impl;
21
22 import org.apache.lenya.workflow.BooleanVariableAssignment;
23 import org.apache.lenya.workflow.WorkflowException;
24 import org.apache.lenya.workflow.WorkflowInstance;
25
26
27 /**
28  * Implementation of a boolean variable assignment.
29  */

30 public class BooleanVariableAssignmentImpl implements BooleanVariableAssignment {
31     
32     /**
33      * Ctor.
34      * @param variable The variable.
35      * @param value The value.
36      */

37     protected BooleanVariableAssignmentImpl(BooleanVariableImpl variable, boolean value) {
38         this.variable = variable;
39
40         this.value = value;
41     }
42
43     private BooleanVariableImpl variable;
44     private boolean value;
45
46     /**
47      * @see org.apache.lenya.workflow.BooleanVariableAssignment#execute(org.apache.lenya.workflow.WorkflowInstance instance)
48      */

49     public void execute(WorkflowInstance instance) throws WorkflowException {
50         WorkflowInstanceImpl impl = (WorkflowInstanceImpl) instance;
51         impl.getVariableInstance(getVariable()).setValue(getValue());
52     }
53
54     /**
55      * Returns the value of this assignment.
56      * @return A boolean value.
57      */

58     public boolean getValue() {
59         return value;
60     }
61
62     /**
63      * Returns the variable of this assignment.
64      * @return A variable.
65      */

66     public BooleanVariableImpl getVariable() {
67         return variable;
68     }
69 }
70
Popular Tags