private static String checkConversationRequired()

in jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationRequiredUtils.java [101:153]


    private static String checkConversationRequired(BeanManager beanManager, ViewConfigDescriptor viewConfigDescriptor)
    {
        Class<? extends ViewConfig> currentView = viewConfigDescriptor.getViewConfig();

        List<PageBeanDescriptor> pageBeanDescriptorList = viewConfigDescriptor.getPageBeanDescriptors();
        for(PageBeanDescriptor pageBeanDescriptor : pageBeanDescriptorList)
        {
            Class<?> pageBeanClass = pageBeanDescriptor.getBeanClass();

            ConversationRequired conversationRequired =
                    resolveConversationRequiredAnnotation(viewConfigDescriptor, pageBeanDescriptorList, pageBeanClass);

            if(conversationRequired == null)
            {
                continue;
            }

            if(!isEntryPoint(currentView, conversationRequired.defaultEntryPoint(), conversationRequired.entryPoints()))
            {
                EditableWindowContext editableWindowContext =
                        (EditableWindowContext)ConversationUtils.getWindowContextManager().getCurrentWindowContext();

                Set<? extends Bean> foundBeans =
                        beanManager.getBeans(pageBeanDescriptor.getBeanClass(), new AnyLiteral());

                Bean<?> foundBean;
                Set<Bean<?>> beanSet;
                Class<?> conversationGroup;
                for(Bean<?> currentBean : foundBeans)
                {
                    beanSet = new HashSet<Bean<?>>(1);
                    beanSet.add(currentBean);
                    foundBean = beanManager.resolve(beanSet);

                    //only page-beans are supported -> we have to compare them by bean-name
                    if(!pageBeanDescriptor.getBeanName().equals(foundBean.getName()))
                    {
                        continue;
                    }

                    conversationGroup = getConversationGroup(conversationRequired, foundBean);

                    if(!editableWindowContext.isConversationActive(conversationGroup,
                            foundBean.getQualifiers().toArray(new Annotation[foundBean.getQualifiers().size()])))
                    {
                        return ViewConfigCache
                                .getViewConfigDescriptor(conversationRequired.defaultEntryPoint()).getViewId();
                    }
                }
            }
        }
        return null;
    }