KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > executor > jsf > FlowExecutionHolder


1 /*
2  * Copyright 2002-2006 the original author or authors.
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 package org.springframework.webflow.executor.jsf;
17
18 import java.io.Serializable JavaDoc;
19
20 import org.springframework.core.style.ToStringCreator;
21 import org.springframework.webflow.execution.FlowExecution;
22 import org.springframework.webflow.execution.ViewSelection;
23 import org.springframework.webflow.execution.repository.FlowExecutionKey;
24
25 /**
26  * A holder storing a reference to a flow execution and the key of that flow
27  * execution if it has been (or is about to be) managed in a repository.
28  *
29  * @author Keith Donald
30  */

31 public class FlowExecutionHolder implements Serializable JavaDoc {
32
33     /**
34      * The flow execution continuation key (may be null if the flow execution
35      * has not yet been generated a repository key). May change as well over the
36      * life of this object, as a flow execution can be given a new key to
37      * capture its state at another point in time.
38      */

39     private FlowExecutionKey flowExecutionKey;
40
41     /**
42      * The held flow execution representing the state of an ongoing conversation
43      * at a point in time.
44      */

45     private FlowExecution flowExecution;
46
47     private ViewSelection viewSelection;
48     
49     private boolean needsSave;
50     
51     /**
52      * Creates a new flow execution holder for a flow execution that has not yet
53      * been placed in a repository.
54      * @param flowExecution the flow execution to hold
55      */

56     public FlowExecutionHolder(FlowExecution flowExecution) {
57         this.flowExecution = flowExecution;
58     }
59
60     /**
61      * Creates a new flow execution holder.
62      * @param flowExecutionKey the continuation key
63      * @param flowExecution the flow execution to hold
64      */

65     public FlowExecutionHolder(FlowExecutionKey flowExecutionKey, FlowExecution flowExecution) {
66         this.flowExecutionKey = flowExecutionKey;
67         this.flowExecution = flowExecution;
68     }
69
70     /**
71      * Returns the continuation key.
72      */

73     public FlowExecutionKey getFlowExecutionKey() {
74         return flowExecutionKey;
75     }
76
77     /**
78      * Sets the continuation key.
79      */

80     public void setFlowExecutionKey(FlowExecutionKey continuationKey) {
81         this.flowExecutionKey = continuationKey;
82     }
83
84     /**
85      * Returns the flow execution.
86      */

87     public FlowExecution getFlowExecution() {
88         return flowExecution;
89     }
90
91     public ViewSelection getViewSelection() {
92         return viewSelection;
93     }
94
95     public void setViewSelection(ViewSelection viewSelection) {
96         this.viewSelection = viewSelection;
97     }
98
99     public boolean needsSave() {
100         return needsSave;
101     }
102     
103     public void markNeedsSave() {
104         this.needsSave = true;
105     }
106     
107     public String JavaDoc toString() {
108         return new ToStringCreator(this).append("flowExecutionKey", flowExecutionKey).append("flowExecution",
109                 flowExecution).toString();
110     }
111 }
Popular Tags