Package org.apache.pluto.portalImpl.aggregation

Examples of org.apache.pluto.portalImpl.aggregation.RootFragment


            return; // we issued an redirect, so return directly
        }

        try
        {
            RootFragment root = PageRegistry.getRootFragment();
            root.service(servletRequest, servletResponse);
        }
        catch (Throwable t)
        {
            // nothing to do
        }
View Full Code Here


            if ( pageName == null ) {
                pageName = "TCK_testpage"+testpageNo++;
            }
           
            // create page with given portlets
            RootFragment root = PageRegistry.getRootFragment();
            ArrayList fragments = new ArrayList();

            PortletApplicationEntityList     entityList     = PortletEntityRegistry.getPortletApplicationEntityList();
            PortletApplicationDefinitionList definitionList = PortletDefinitionRegistry.getPortletApplicationDefinitionList();

            // put all portlets in one column
            StringTokenizer tokenizer;
            Iterator appIt, portletIt;
            for ( int i=0; i < portletNames.length; ++i) {
                tokenizer =  new StringTokenizer(portletNames[i], "/");
                String appName = tokenizer.nextToken();
                String portletName = tokenizer.nextToken();
                appIt = entityList.iterator();
                PortletApplicationEntity appEntity = null;
                // search for application
                boolean found = false;
                while ( appIt.hasNext() && ! found ) {           
                    appEntity = (PortletApplicationEntity) appIt.next();
                    String displayName = appEntity.getPortletApplicationDefinition().getWebApplicationDefinition().getDisplayName(Locale.ENGLISH).getDisplayName();
                    if ( (displayName != null) && (displayName.equals(appName)) )
                      found = true;
                }
                if (!found) {
                    for (Iterator iter = definitionList.iterator(); !found && iter.hasNext();) {
                        PortletApplicationDefinition portletApp = (PortletApplicationDefinition)iter.next();
                        if (portletApp.getId().toString().equals(appName)) {
                            //PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)ControllerObjectAccess.get(entityList);
                            PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)entityList;
                            appEntity = appEntityListCtrl.add(portletApp.getId().toString());
                            log("added Portlet Application " + appName + " to PortletEntityRegistry");
                            found = true;
                        }
                    }
                }
                if ( !found ) {
                    log("Portlet Application "+appName+" not found!");
                    throw new ServletException("Portlet Application "+appName+" not found!");
                }
                portletIt = appEntity.getPortletEntityList().iterator();
                PortletEntity portlet = null;
                // search for portlet
                found = false;
                while ( portletIt.hasNext() && ! found ) {
                    portlet = (PortletEntity) portletIt.next();
                    PortletDefinition tmpPortletDef = portlet.getPortletDefinition();
                    if ( tmpPortletDef == null ) {
                      log("ERROR: Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                      log("       Portlet may not be defined in portlet.xml!");
                      throw new ServletException("Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                  }
                    String tmpPortletName = tmpPortletDef.getName();
                    //delete all existing preferences for this portlet entity
                    if (tmpPortletName != null && tmpPortletName.equals(portletName)) {
                        for (Iterator iter = portlet.getPreferenceSet().iterator(); iter.hasNext();) {
                            iter.next();
                            iter.remove();
                        }
                        found = true;
                    }
                }
                if (!found) {
                    for (Iterator appIter = definitionList.iterator(); !found && appIter.hasNext();) {
                        PortletApplicationDefinition appDef = (PortletApplicationDefinition)appIter.next();
                        if (appDef.getId().toString().equals(appName)) {
                            for (Iterator portletIter = appDef.getPortletDefinitionList().iterator(); !found && portletIter.hasNext();) {
                                PortletDefinition portletDef = (PortletDefinition)portletIter.next();
                                if (portletDef.getId().toString().equals(appName + "." + portletName)) {
                                    //PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)ControllerObjectAccess.get(appEntity.getPortletEntityList());
                                    PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)appEntity.getPortletEntityList();
                                    portlet = entityListCtrl.add(appEntity, portletDef.getId().toString());
                                    PortletEntityRegistry.refresh(portlet);
                                    log("added Portlet " + portletName + " to PortletEntityRegistry");
                                    found = true;
                                }
                            }
                        }
                    }
                }
                if ( ! found ) {
                    log("ERROR: Portlet "+portletName+" not found!");
                    throw new ServletException("Portlet "+portletName+" not found!");
                }
                FragmentImpl tckPortlet = new FragmentImpl();
                tckPortlet.setType("portlet");
                tckPortlet.setName("p"+windowNo++);   // set portlet
                // property
                PropertyImpl property = new PropertyImpl();
                property.setName("portlet");
                property.setValue(portlet.getId().toString());
                tckPortlet.getProperties().add(property);
                fragments.add(tckPortlet);
            }
            FragmentImpl tckCol = new FragmentImpl();
            tckCol.setType("column");
            tckCol.setName("col");
            tckCol.setFragments(fragments);       
            ArrayList colFragments = new ArrayList();
            colFragments.add(tckCol);
            FragmentImpl tckRow = new FragmentImpl();
            tckRow.setType("row");
            tckRow.setName("row");
            tckRow.setFragments(colFragments);
            ArrayList rowFragments = new ArrayList();
            rowFragments.add(tckRow);
            //page
            FragmentImpl tckPage = new FragmentImpl();
            tckPage.setType("page");
            tckPage.setName(pageName);
            // navigation
            NavigationImpl tckNav = new NavigationImpl();
            tckNav.setTitle(pageName);
            tckNav.setDescription("dynamically generated TCK test page");
            tckPage.setNavigation(tckNav);
            tckPage.setFragments(rowFragments);
  
            try {
                org.apache.pluto.portalImpl.aggregation.Fragment rootFragment =
                    tckPage.build(getServletConfig(), root);
                root.addChild(rootFragment);
            } catch (Exception e) {
                log("Exception in building new TCK page occured! "+e.getMessage());
                throw new ServletException("Exception in building new TCK page occured!", e);               
            }
View Full Code Here

            return; // we issued an redirect, so return directly
        }

        try
        {
            RootFragment root = PageRegistry.getRootFragment();
            root.service(servletRequest, servletResponse);
        }
        catch (Throwable t)
        {
            ;
        }
View Full Code Here

            return; // we issued an redirect, so return directly
        }

        try
        {
            RootFragment root = PageRegistry.getRootFragment();
            root.service(servletRequest, servletResponse);
        }
        catch (Throwable t)
        {
            // nothing to do
        }
View Full Code Here

            if ( pageName == null ) {
                pageName = "TCK_testpage"+testpageNo++;
            }
           
            // create page with given portlets
            RootFragment root = PageRegistry.getRootFragment();
            ArrayList fragments = new ArrayList();

            PortletApplicationEntityList     entityList     = PortletEntityRegistry.getPortletApplicationEntityList();
            PortletApplicationDefinitionList definitionList = PortletDefinitionRegistry.getPortletApplicationDefinitionList();

            // put all portlets in one column
            StringTokenizer tokenizer;
            Iterator appIt, portletIt;
            for ( int i=0; i < portletNames.length; ++i) {
                tokenizer =  new StringTokenizer(portletNames[i], "/");
                String appName = tokenizer.nextToken();
                String portletName = tokenizer.nextToken();
                appIt = entityList.iterator();
                PortletApplicationEntity appEntity = null;
                // search for application
                boolean found = false;
                while ( appIt.hasNext() && ! found ) {           
                    appEntity = (PortletApplicationEntity) appIt.next();
                    String displayName = appEntity.getPortletApplicationDefinition().getWebApplicationDefinition().getDisplayName(Locale.ENGLISH).getDisplayName();
                    if ( (displayName != null) && (displayName.equals(appName)) )
                      found = true;
                }
                if (!found) {
                    for (Iterator iter = definitionList.iterator(); !found && iter.hasNext();) {
                        PortletApplicationDefinition portletApp = (PortletApplicationDefinition)iter.next();
                        if (portletApp.getId().toString().equals(appName)) {
                            //PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)ControllerObjectAccess.get(entityList);
                            PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)entityList;
                            appEntity = appEntityListCtrl.add(portletApp.getId().toString());
                            log("added Portlet Application " + appName + " to PortletEntityRegistry");
                            found = true;
                        }
                    }
                }
                if ( !found ) {
                    log("Portlet Application "+appName+" not found!");
                    throw new ServletException("Portlet Application "+appName+" not found!");
                }
                portletIt = appEntity.getPortletEntityList().iterator();
                PortletEntity portlet = null;
                // search for portlet
                found = false;
                while ( portletIt.hasNext() && ! found ) {
                    portlet = (PortletEntity) portletIt.next();
                    PortletDefinition tmpPortletDef = portlet.getPortletDefinition();
                    if ( tmpPortletDef == null ) {
                      log("ERROR: Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                      log("       Portlet may not be defined in portlet.xml!");
                      throw new ServletException("Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                  }
                    String tmpPortletName = tmpPortletDef.getName();
                    //delete all existing preferences for this portlet entity
                    if (tmpPortletName != null && tmpPortletName.equals(portletName)) {
                        for (Iterator iter = portlet.getPreferenceSet().iterator(); iter.hasNext();) {
                            iter.next();
                            iter.remove();
                        }
                        found = true;
                    }
                }
                if (!found) {
                    for (Iterator appIter = definitionList.iterator(); !found && appIter.hasNext();) {
                        PortletApplicationDefinition appDef = (PortletApplicationDefinition)appIter.next();
                        if (appDef.getId().toString().equals(appName)) {
                            for (Iterator portletIter = appDef.getPortletDefinitionList().iterator(); !found && portletIter.hasNext();) {
                                PortletDefinition portletDef = (PortletDefinition)portletIter.next();
                                if (portletDef.getId().toString().equals(appName + "." + portletName)) {
                                    //PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)ControllerObjectAccess.get(appEntity.getPortletEntityList());
                                    PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)appEntity.getPortletEntityList();
                                    portlet = entityListCtrl.add(appEntity, portletDef.getId().toString());
                                    PortletEntityRegistry.refresh(portlet);
                                    log("added Portlet " + portletName + " to PortletEntityRegistry");
                                    found = true;
                                }
                            }
                        }
                    }
                }
                if ( ! found ) {
                    log("ERROR: Portlet "+portletName+" not found!");
                    throw new ServletException("Portlet "+portletName+" not found!");
                }
                FragmentImpl tckPortlet = new FragmentImpl();
                tckPortlet.setType("portlet");
                tckPortlet.setName("p"+windowNo++);   // set portlet
                // property
                PropertyImpl property = new PropertyImpl();
                property.setName("portlet");
                property.setValue(portlet.getId().toString());
                tckPortlet.getProperties().add(property);
                fragments.add(tckPortlet);
            }
            FragmentImpl tckCol = new FragmentImpl();
            tckCol.setType("column");
            tckCol.setName("col");
            tckCol.setFragments(fragments);       
            ArrayList colFragments = new ArrayList();
            colFragments.add(tckCol);
            FragmentImpl tckRow = new FragmentImpl();
            tckRow.setType("row");
            tckRow.setName("row");
            tckRow.setFragments(colFragments);
            ArrayList rowFragments = new ArrayList();
            rowFragments.add(tckRow);
            //page
            FragmentImpl tckPage = new FragmentImpl();
            tckPage.setType("page");
            tckPage.setName(pageName);
            // navigation
            NavigationImpl tckNav = new NavigationImpl();
            tckNav.setTitle(pageName);
            tckNav.setDescription("dynamically generated TCK test page");
            tckPage.setNavigation(tckNav);
            tckPage.setFragments(rowFragments);
  
            try {
                org.apache.pluto.portalImpl.aggregation.Fragment rootFragment =
                    tckPage.build(getServletConfig(), root);
                root.addChild(rootFragment);
            } catch (Exception e) {
                log("Exception in building new TCK page occured! "+e.getMessage());
                throw new ServletException("Exception in building new TCK page occured!", e);               
            }
View Full Code Here

            return; // we issued an redirect, so return directly
        }

        try
        {
            RootFragment root = PageRegistry.getRootFragment();
            root.service(servletRequest, servletResponse);
        }
        catch (Throwable t)
        {
            log.error(t);
            // nothing to do
View Full Code Here

TOP

Related Classes of org.apache.pluto.portalImpl.aggregation.RootFragment

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.