Package org.apache.myfaces.flow

Examples of org.apache.myfaces.flow.FlowReference


        FacesContext facesContext = FacesContext.getCurrentInstance();

        checkActive(facesContext);

       
        FlowReference reference = flowBeanReferences.get(((Bean)bean).getBeanClass());
        if (reference != null)
        {
            String flowMapKey = getFlowScopeBeanHolder().getFlowMapKey(facesContext, reference);
            if (flowMapKey != null)
            {
                ContextualStorage storage = getContextualStorage(false, flowMapKey);
                if (storage != null)
                {
                    Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
                    ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

                    if (contextualInstanceInfo != null)
                    {
                        return (T) contextualInstanceInfo.getContextualInstance();
                    }
                }
            }
            else
            {
                throw new IllegalStateException("Flow "+ reference.getId()+
                    " cannot be found when resolving bean " +bean.toString());
            }
        }
       
        List<String> activeFlowMapKeys = getFlowScopeBeanHolder().getActiveFlowMapKeys(facesContext);
View Full Code Here


        {
            throw new IllegalStateException(bean.toString() +
                    " doesn't implement " + PassivationCapable.class.getName());
        }
       
        FlowReference reference = flowBeanReferences.get(((Bean)bean).getBeanClass());
        if (reference != null)
        {
            String flowMapKey = getFlowScopeBeanHolder().getFlowMapKey(facesContext, reference);
            if (flowMapKey != null)
            {
                ContextualStorage storage = getContextualStorage(false, flowMapKey);
                if (storage != null)
                {
                    Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
                    ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

                    if (contextualInstanceInfo != null)
                    {
                        return (T) contextualInstanceInfo.getContextualInstance();
                    }
                }
            }
            else
            {
                throw new IllegalStateException("Flow "+ reference.getId()+
                    " cannot be found when resolving bean " + bean.toString());
            }
           
            FlowHandler flowHandler = facesContext.getApplication().getFlowHandler();
            // Since it is possible to have only the flow id without documentId, the best
            // is first get the flow using flowHandler.getFlow and then check if the flow is
            // active or not, but using the documentId and id of the retrieved flow.
            Flow flow = flowHandler.getFlow(facesContext,
                reference.getDocumentId() == null ? "" : reference.getDocumentId(), reference.getId());
            if (flow == null)
            {
                throw new IllegalStateException(bean.toString() + "cannot be created because flow "+ reference.getId()+
                    " is not registered");
            }
            if (!flowHandler.isActive(facesContext, flow.getDefiningDocumentId(), flow.getId()))
            {
                throw new IllegalStateException(bean.toString() + "cannot be created if flow "+ reference.getId()+
                    " is not active");
            }
           
            ContextualStorage storage = getContextualStorage(true, flowMapKey);
            Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
View Full Code Here

        {
            FlowScoped flowScoped = event.getAnnotated().getAnnotation(FlowScoped.class);
            String flowId = flowScoped.value();
            if (flowId != null)
            {
                flowBeanReferences.put(event.getBean().getBeanClass(), new FlowReference(
                    flowScoped.definingDocumentId(), flowId));
            }
        }
    }
View Full Code Here

        FacesContext facesContext = FacesContext.getCurrentInstance();

        checkActive(facesContext);

       
        FlowReference reference = flowBeanReferences.get(((Bean)bean).getBeanClass());
        if (reference != null)
        {
            String flowMapKey = getFlowScopeBeanHolder().getFlowMapKey(facesContext, reference);
            if (flowMapKey != null)
            {
                ContextualStorage storage = getContextualStorage(false, flowMapKey);
                if (storage != null)
                {
                    Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
                    ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

                    if (contextualInstanceInfo != null)
                    {
                        return (T) contextualInstanceInfo.getContextualInstance();
                    }
                }
            }
            else
            {
                throw new IllegalStateException("Flow "+ reference.getId()+
                    " cannot be found when resolving bean " +bean.toString());
            }
        }
       
        List<String> activeFlowMapKeys = getFlowScopeBeanHolder().getActiveFlowMapKeys(facesContext);
View Full Code Here

                throw new IllegalStateException(bean.toString() +
                        " doesn't implement " + PassivationCapable.class.getName());
            }
        }
       
        FlowReference reference = flowBeanReferences.get(((Bean)bean).getBeanClass());
        if (reference != null)
        {
            String flowMapKey = getFlowScopeBeanHolder().getFlowMapKey(facesContext, reference);
            if (flowMapKey != null)
            {
                ContextualStorage storage = getContextualStorage(false, flowMapKey);
                if (storage != null)
                {
                    Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
                    ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));

                    if (contextualInstanceInfo != null)
                    {
                        return (T) contextualInstanceInfo.getContextualInstance();
                    }
                }
            }
            else
            {
                throw new IllegalStateException("Flow "+ reference.getId()+
                    " cannot be found when resolving bean " + bean.toString());
            }
           
            if (!facesContext.getApplication().getFlowHandler().isActive(facesContext,
                    reference.getDocumentId() == null ? "" : reference.getDocumentId(), reference.getId()))
            {
                throw new IllegalStateException(bean.toString() + "cannot be created if flow "+ reference.getId()+
                    " is not active");
            }
           
            ContextualStorage storage = getContextualStorage(true, flowMapKey);
            Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
View Full Code Here

TOP

Related Classes of org.apache.myfaces.flow.FlowReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.