jakarta.faces.flow.Flow Maven / Gradle / Ivy
Show all versions of jakarta.faces Show documentation
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.flow;
import java.util.List;
import java.util.Map;
import java.util.Set;
import jakarta.el.MethodExpression;
import jakarta.faces.application.NavigationCase;
import jakarta.faces.lifecycle.ClientWindow;
/**
*
* Flow is the runtime representation of a Faces Flow. Once placed into service by the runtime, an
* instance of this class is immutable. The implementation must be thread-safe because instances will be shared across
* all usages of the flow within the application.
*
*
*
* The current {@code Flow} can be injected into a CDI managed bean using {@code @Inject Flow currentFlow;}
*
*
* @since 2.2
*/
public abstract class Flow {
//
/**
*
* Return the immutable id for this Flow. This must be unique within the defining document (such as an Application
* Configuration Resources file), but need not be unique within the entire application.
*
*
* @return the id.
*
* @since 2.2
*/
public abstract String getId();
/**
*
* Return the immutable application unique identifier for the document in which the argument flow is defined.
*
*
* @return the defining document id
*
* @since 2.2
*/
public abstract String getDefiningDocumentId();
/**
*
* Return the immutable id for the default node that should be activated when this flow is entered.
*
*
* @return the id of the start node
*
* @since 2.2
*/
public abstract String getStartNodeId();
/**
*
* Return the {@code MethodExpression} that must be called by the runtime as the last thing that happens before exiting
* this flow. Any {@link FlowScoped} beans declared for this flow must remain in scope until after control returns from
* the method referenced by this {@code MethodExpression}.
*
*
* @return the {@code MethodExpresion} for the finalizer.
*
* @since 2.2
*/
public abstract MethodExpression getFinalizer();
/**
*
* Return the {@code MethodExpression} that must be called by the runtime immediately after activating any
* {@link FlowScoped} beans declared for this flow.
*
*
* @return the {@code MethodExpresion} for the initializer.
*
* @since 2.2
*/
public abstract MethodExpression getInitializer();
//
//
/**
*
* Return an immutable data structure containing the inbound parameters that have been declared for this flow. See
* {@link FlowHandler#transition} for the specification of how these parameters are used. Inbound parameters are
* associated with a specific flow instance, while outbound parameters are associated with a {@link FlowCallNode} that
* causes the transition to a new flow.
*
*
* @return the inbound parameters
*
* @since 2.2
*/
public abstract Map getInboundParameters();
/**
*
* Return an immutable data structure containing all of the view nodes declared for this flow.
*
*
* @return the view nodes for this flow
* @since 2.2
*/
public abstract List getViews();
/**
*
* Return an immutable data structure containing all of the return nodes declared for this flow.
*
*
* @return the return nodes for this flow.
*
* @since 2.2
*/
public abstract Map getReturns();
/**
*
* Return an immutable data structure containing all of the switch nodes declared for this flow.
*
*
* @return the switch nodes for this flow
*
* @since 2.2
*/
public abstract Map getSwitches();
/**
*
* Return an immutable data structure containing all the flow call nodes declared for this flow.
*
*
* @return the flow call nodes for this flow
*
* @since 2.2
*/
public abstract Map getFlowCalls();
/**
*
* Return the {@link FlowCallNode} that represents calling the {@code targetFlow} from this flow, or {@code null} if
* {@code targetFlow} cannot be reached from this flow.
*
*
* @param targetFlow the flow for which the {@link FlowCallNode} is to be returned
*
* @return a {@link FlowCallNode} for the argument flow or {@code null}
*
* @since 2.2
*/
public abstract FlowCallNode getFlowCall(Flow targetFlow);
/**
*
* Return an immutable data structure containing all the method call nodes declared for this flow.
*
*
* @return the method call nodes for this flow
*
* @since 2.2
*/
public abstract List getMethodCalls();
//
//
/**
*
* Return the generic {@link FlowNode} by id, or {@code null} if not found.
*
*
* @param nodeId the node id for which the {@link FlowNode} is to be returned
*
* @return the {@link FlowNode} or {@code null}
*/
public abstract FlowNode getNode(String nodeId);
/**
*
* Return an unmodifiable view of the navigation cases within this flow.
*
*
* @return the navigation cases,
*/
public abstract Map> getNavigationCases();
//
//
/**
*
* Get the {@link ClientWindow}'s id and append "_" and the return from {@link #getId}. Return the result.
*
*
* @return the generated client window id for this flow.
*
* @param curWindow the
*
* @since 2.2
*/
public abstract String getClientWindowFlowId(ClientWindow curWindow);
//
}