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.definition; 17 18 /** 19 * The definition of a flow, a program that when executed carries out the 20 * orchestration of a task on behalf of a single client. 21 * <p> 22 * A flow definition is a reusable, self-contained controller module that 23 * defines a blue print for an executable user task. Flows typically orchestrate 24 * controlled navigations or dialogs within web applications to guide users 25 * through fulfillment of a business process/goal that takes place over a series 26 * of steps, modeled as states. 27 * <p> 28 * Structurally a flow definition is composed of a set of states. A 29 * {@link StateDefinition state} is a point in a flow where a behavior is 30 * executed; for example, showing a view, executing an action, spawning a 31 * subflow, or terminating the flow. Different types of states execute different 32 * behaviors in a polymorphic fashion. Most states are 33 * {@link TransitionableStateDefinition transitionable states}, meaning they 34 * can respond to events by taking the flow from one state to another. 35 * <p> 36 * Each flow has exactly one {@link #getStartState() start state} which defines 37 * the starting point of the program. 38 * <p> 39 * This interface exposes the flow's identifier, states, and other definitional 40 * attributes. It is suitable for introspection by tools as well as user-code at 41 * flow execution time. 42 * <p> 43 * Flow definitions may be annotated with attributes. 44 * 45 * @author Keith Donald 46 * @author Erwin Vervaet 47 */ 48 public interface FlowDefinition extends Annotated { 49 50 /** 51 * Returns the unique id of this flow. 52 * @return the flow id 53 */ 54 public String getId(); 55 56 /** 57 * Return this flow's starting point. 58 * @return the start state 59 */ 60 public StateDefinition getStartState(); 61 62 /** 63 * Returns the state definition with the specified id. 64 * @param id the state id 65 * @return the state definition 66 * @throws IllegalArgumentException if a state with this id does not exist 67 */ 68 public StateDefinition getState(String id) throws IllegalArgumentException; 69 }