Package org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi

Examples of org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContext


                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();
                    }
View Full Code Here


                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();
                    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public synchronized WindowContext getWindowContext(String windowContextId)
    {
        EditableWindowContext result = this.windowContextMap.get(windowContextId);

        if(result != null && !result.isActive())
        {
            closeWindowContext(result);
            result = null;
        }

        if (result == null)
        {
            result = createWindowContext(windowContextId);

            this.windowContextMap.put(windowContextId, result);
        }

        result.touch();

        return result;
    }
View Full Code Here

        {
            return windowContextFactory.createWindowContext(
                    windowContextId, this.windowContextConfig, this.conversationConfig);
        }

        EditableWindowContext windowContext = new JsfWindowContext(windowContextId,
                                                                   this.windowContextConfig,
                                                                   this.conversationConfig,
                                                                   this.projectStageDevelopment,
                                                                   this.beanManager);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public boolean isWindowContextActive(String windowContextId)
    {
        EditableWindowContext editableWindowContext = this.windowContextMap.get(windowContextId);

        return editableWindowContext != null && editableWindowContext.isActive();
    }
View Full Code Here

            {
                return;
            }
        }

        EditableWindowContext windowContext = (EditableWindowContext)windowContextManager.getCurrentWindowContext();
        //don't refactor it to a lazy restore
        storeCurrentViewIdAsNewViewId(phaseEvent.getFacesContext(), windowContext);

        //don't refactor it - the messages have to be restored directly after restoring the window-context(-id)
        tryToRestoreMessages(phaseEvent.getFacesContext(), windowContext, jsfModuleConfig);
View Full Code Here

    {
        Class conversationGroup = ConversationUtils.getConversationGroup(bean);

        Set<Annotation> qualifiers = bean.getQualifiers();

        EditableWindowContext editableWindowContext = (EditableWindowContext)RequestCache.getCurrentWindowContext();

        if(editableWindowContext == null)
        {
            editableWindowContext = (EditableWindowContext)windowContextManager.getCurrentWindowContext();
            //also done by the default implementation but this also ensures that custom impls are fast
            RequestCache.setCurrentWindowContext(editableWindowContext);
        }

        try
        {
            if(this.useFallback)
            {
                WeldCache.setBean(bean);
            }

            return editableWindowContext
                    .getConversation(conversationGroup, qualifiers.toArray(new Annotation[qualifiers.size()]));
        }
        finally
        {
            if(this.useFallback)
View Full Code Here

    }

    private void removeEldestWindowContext(EditableWindowContextManager editableWindowContextManager,
                                           Collection<EditableWindowContext> activeWindowContexts)
    {
        EditableWindowContext windowContextToRemove = findEldestWindowContext(activeWindowContexts);

        if(windowContextToRemove != null)
        {
            editableWindowContextManager.closeWindowContext(windowContextToRemove);
        }
View Full Code Here

    }

    private EditableWindowContext findEldestWindowContext(Collection<EditableWindowContext> activeWindowContexts)
    {
        Date lastAccess = new Date();
        EditableWindowContext result = null;
        for(EditableWindowContext windowContext : activeWindowContexts)
        {
            if(lastAccess.after(windowContext.getLastAccess()))
            {
                lastAccess = windowContext.getLastAccess();
View Full Code Here

            {
                return;
            }
        }

        EditableWindowContext windowContext = (EditableWindowContext)windowContextManager.getCurrentWindowContext();
        //don't refactor it to a lazy restore
        storeCurrentViewIdAsNewViewId(phaseEvent.getFacesContext(), windowContext);

        //don't refactor it - the messages have to be restored directly after restoring the window-context(-id)
        tryToRestoreMessages(phaseEvent.getFacesContext(), windowContext, jsfModuleConfig);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContext

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.