use of com.sun.faces.flow.FlowDiscoveryCDIExtension in project mojarra by eclipse-ee4j.
the class JavaFlowLoaderHelper method loadFlows.
synchronized void loadFlows(FacesContext context, FlowHandler flowHandler) throws IOException {
BeanManager beanManager = getCdiBeanManager(context);
FlowDiscoveryCDIExtension flowDiscoveryCDIExtension = CdiUtils.getBeanReference(beanManager, FlowDiscoveryCDIExtension.class);
if (flowDiscoveryCDIExtension == null) {
if (LOGGER.isLoggable(SEVERE)) {
LOGGER.log(SEVERE, "Unable to obtain {0} from CDI implementation. Flows described with {1} are unavailable.", new String[] { FlowDiscoveryCDIExtension.class.getName(), FlowDefinition.class.getName() });
}
return;
}
List<Producer<Flow>> flowProducers = flowDiscoveryCDIExtension.getFlowProducers();
if (!flowProducers.isEmpty()) {
enableClientWindowModeIfNecessary(context);
}
WebConfiguration config = WebConfiguration.getInstance();
for (Producer<Flow> flowProducer : flowProducers) {
Flow toAdd = flowProducer.produce(beanManager.<Flow>createCreationalContext(null));
if (toAdd == null) {
LOGGER.log(SEVERE, "Flow producer method {0}() returned null. Ignoring.", flowProducer.toString());
} else {
flowHandler.addFlow(context, toAdd);
config.setHasFlows(true);
}
}
}
Aggregations