01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: /* $Id: BooleanVariableAssignmentImpl.java 473861 2006-11-12 03:51:14Z gregor $ */
20:
21: package org.apache.lenya.workflow.impl;
22:
23: import org.apache.lenya.workflow.BooleanVariableAssignment;
24: import org.apache.lenya.workflow.Version;
25: import org.apache.lenya.workflow.WorkflowException;
26:
27: /**
28: * Implementation of a boolean variable assignment.
29: */
30: public class BooleanVariableAssignmentImpl implements
31: BooleanVariableAssignment {
32:
33: /**
34: * Ctor.
35: * @param name The variable name.
36: * @param value The value.
37: */
38: protected BooleanVariableAssignmentImpl(String name, boolean value) {
39: this .variable = name;
40: this .value = value;
41: }
42:
43: private String variable;
44: private boolean value;
45:
46: /**
47: * @see org.apache.lenya.workflow.Action#execute(org.apache.lenya.workflow.Version)
48: */
49: public void execute(Version resultingVersion)
50: throws WorkflowException {
51: resultingVersion.setValue(getVariable(), getValue());
52: }
53:
54: /**
55: * Returns the value of this assignment.
56: * @return A boolean value.
57: */
58: public boolean getValue() {
59: return this .value;
60: }
61:
62: /**
63: * Returns the variable of this assignment.
64: * @return A variable.
65: */
66: public String getVariable() {
67: return this.variable;
68: }
69: }
|