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.support; 17 18 import org.springframework.webflow.context.ExternalContext; 19 import org.springframework.webflow.execution.repository.FlowExecutionKey; 20 import org.springframework.webflow.executor.FlowExecutor; 21 22 /** 23 * A helper strategy used by the {@link FlowRequestHandler} to extract 24 * {@link FlowExecutor} method arguments from a request initiated by 25 * an {@link ExternalContext}. The extracted arguments were typically 26 * exposed in the previous response (the response that resulted in 27 * a new request) using a {@link FlowExecutorArgumentExposer}. 28 * 29 * @author Keith Donald 30 * @author Erwin Vervaet 31 */ 32 public interface FlowExecutorArgumentExtractor { 33 34 /** 35 * Returns true if the flow id is extractable from the context. 36 * @param context the context in which a external user event occured 37 * @return true if extractable, false if not 38 */ 39 public boolean isFlowIdPresent(ExternalContext context); 40 41 /** 42 * Extracts the flow id from the external context. 43 * @param context the context in which a external user event occured 44 * @return the extracted flow id 45 * @throws FlowExecutorArgumentExtractionException if the flow id could not 46 * be extracted 47 */ 48 public String extractFlowId(ExternalContext context) throws FlowExecutorArgumentExtractionException; 49 50 /** 51 * Returns true if the flow execution key is extractable from the context. 52 * @param context the context in which a external user event occured 53 * @return true if extractable, false if not 54 */ 55 public boolean isFlowExecutionKeyPresent(ExternalContext context); 56 57 /** 58 * Extract the flow execution key from the external context. 59 * @param context the context in which the external user event occured 60 * @return the obtained flow execution key 61 * @throws FlowExecutorArgumentExtractionException if the flow execution key 62 * could not be extracted 63 */ 64 public String extractFlowExecutionKey(ExternalContext context) throws FlowExecutorArgumentExtractionException; 65 66 /** 67 * Returns true if the event id is extractable from the context. 68 * @param context the context in which a external user event occured 69 * @return true if extractable, false if not 70 */ 71 public boolean isEventIdPresent(ExternalContext context); 72 73 /** 74 * Extract the flow execution event id from the external context. 75 * <p> 76 * This method should only be called if a {@link FlowExecutionKey} was 77 * successfully extracted, indicating a request to resume a flow execution. 78 * @param context the context in which a external user event occured 79 * @return the event id 80 * @throws FlowExecutorArgumentExtractionException if the event id could not 81 * be extracted 82 */ 83 public String extractEventId(ExternalContext context) throws FlowExecutorArgumentExtractionException; 84 85 }