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 java.util.Map; 19 20 import org.springframework.webflow.context.ExternalContext; 21 import org.springframework.webflow.execution.FlowExecutionContext; 22 import org.springframework.webflow.execution.support.ExternalRedirect; 23 import org.springframework.webflow.execution.support.FlowDefinitionRedirect; 24 import org.springframework.webflow.execution.support.FlowExecutionRedirect; 25 import org.springframework.webflow.executor.FlowExecutor; 26 27 /** 28 * Helper strategy that can expose {@link FlowExecutor} method arguments in 29 * a response (view) so that subsequent requests resulting from the response 30 * can have those arguments extracted again, typically using a 31 * {@link FlowExecutorArgumentExtractor}. 32 * <p> 33 * Arguments can either be exposed in the model of a view that will be 34 * rendered or in a URL that will be used to trigger a new request into 35 * Spring Web Flow, for instance using a redirect. 36 * 37 * @author Erwin Vervaet 38 */ 39 public interface FlowExecutorArgumentExposer { 40 41 /** 42 * Expose the flow execution context and it's key in given model map. 43 * @param flowExecutionKey the flow execution key (may be null if the 44 * conversation has ended) 45 * @param context the flow execution context 46 * @param model the model map 47 */ 48 public void exposeFlowExecutionContext(String flowExecutionKey, FlowExecutionContext context, Map model); 49 50 /** 51 * Create a URL that when redirected to launches a entirely new execution of 52 * a flow definition (starts a new conversation). Used to support the <i>restart flow</i> 53 * and <i>redirect to flow</i> use cases. 54 * @param flowDefinitionRedirect the flow definition redirect view selection 55 * @param context the external context 56 * @return the relative flow URL path to redirect to 57 */ 58 public String createFlowDefinitionUrl(FlowDefinitionRedirect flowDefinitionRedirect, ExternalContext context); 59 60 /** 61 * Create a URL path that when redirected to renders the <i>current</i> (or 62 * last) view selection made by the flow execution identified by the flow 63 * execution key. Used to support the <i>flow execution redirect</i> use 64 * case. 65 * @param flowExecutionKey the flow execution key 66 * @param flowExecution the flow execution 67 * @param context the external context 68 * @return the relative conversation URL path 69 * @see FlowExecutionRedirect 70 */ 71 public String createFlowExecutionUrl(String flowExecutionKey, FlowExecutionContext flowExecution, 72 ExternalContext context); 73 74 /** 75 * Create a URL path that when redirected to communicates with an external 76 * system outside of Spring Web Flow. 77 * @param redirect the external redirect request 78 * @param flowExecutionKey the flow execution key to send through the 79 * redirect (optional) 80 * @param context the external context 81 * @return the external URL 82 */ 83 public String createExternalUrl(ExternalRedirect redirect, String flowExecutionKey, ExternalContext context); 84 85 } 86