Examples of BaseFragmentsElement


Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

        try
        {
            Criteria filter = new Criteria();
            filter.addEqualTo("path", path);
            QueryByCriteria query = QueryFactory.newQuery(fragmentsElementImplType, filter);
            BaseFragmentsElement fragmentsElement = (BaseFragmentsElement)getPersistenceBrokerTemplate().getObjectByQuery(query);
           
            // return page element or throw exception
            if (fragmentsElement == null)
            {
                throw new PageNotFoundException("Fragments/page element " + path + " not found.");
            }

            // check for view access on page element
            fragmentsElement.checkAccess(JetspeedActions.VIEW);

            return fragmentsElement;
        }
        catch (PageNotFoundException pnfe)
        {
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

     * @throws SecurityException if page view access not granted
     */
    public boolean isConcretePage() throws NodeNotFoundException
    {
        // check current page type and content path
        BaseFragmentsElement pageOrTemplate = getPageOrTemplate();
        String pageContentPath = getPageContentPath();
        return ((pageOrTemplate instanceof Page) || ((pageOrTemplate instanceof DynamicPage) && (pageContentPath != null)));
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

    public PageTemplate getPageTemplate() throws NodeNotFoundException
    {
        if (!requestPageTemplateCached)
        {
            // get requested page
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate();
            if (pageOrTemplate != null)
            {
                // scan through site looking for first page template
                // up the folder hierarchy from the requested page
                try
                {
                    Folder folder = (Folder)pageOrTemplate.getParent();
                    while ((folder != null) && (requestPageTemplate == null))
                    {
                        NodeSet pageTemplates = folder.getPageTemplates();
                        if ((pageTemplates != null) && !pageTemplates.isEmpty())
                        {
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

    public Map getFragmentDefinitions() throws NodeNotFoundException
    {
        if (!requestFragmentDefinitionsCached)
        {
            // get requested page or template and optional page template
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate();
            PageTemplate pageTemplate = getPageTemplate();
            if (pageOrTemplate != null)
            {
                // merge fragment reference ids from requested page and page template
                Set refIds = new HashSet(4);
                List requestPageFragmentReferences = pageOrTemplate.getFragmentsByInterface(FragmentReference.class);
                mergeFragmentDefinitionRefIds(requestPageFragmentReferences, refIds);
                List requestPageTemplateFragmentReferences = ((pageTemplate != null) ? pageTemplate.getFragmentsByInterface(FragmentReference.class) : null);
                mergeFragmentDefinitionRefIds(requestPageTemplateFragmentReferences, refIds);
               
                // scan through site looking for each first matching fragment
                // definition by reference/definition id up the folder hierarchy
                // from the requested page
                Iterator refIdsIter = refIds.iterator();
                while (refIdsIter.hasNext())
                {
                    String refId = (String)refIdsIter.next();
                    FragmentDefinition requestFragmentDefinition = null;
                    try
                    {
                        // scan for fragment definition
                        Folder folder = (Folder)pageOrTemplate.getParent();
                        while ((folder != null) && (requestFragmentDefinition == null))
                        {
                            NodeSet fragmentDefinitions = folder.getFragmentDefinitions();
                            if ((fragmentDefinitions != null) && !fragmentDefinitions.isEmpty())
                            {
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

     * @throws SecurityException if page view access not granted
     */
    public Folder getFolder() throws NodeNotFoundException
    {
        // return parent folder of request page or template
        BaseFragmentsElement pageOrTemplate = getPageOrTemplate();
        if (pageOrTemplate != null)
        {
            return (Folder)pageOrTemplate.getParent();
        }
        return null;
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

     */
    public boolean equals( Object obj )
    {
        if (obj instanceof BaseFragmentsElement)
        {
            BaseFragmentsElement fragmentsElement = (BaseFragmentsElement) obj;
            return fragmentsElement.getId() != null && getId() != null && getId().equals(fragmentsElement.getId());
        }
        return false;
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

                success = false;
                resultMap.put(REASON, "Insufficient access to administer portal permissions");               
                return success;
            }          
            int count = 0;
            BaseFragmentsElement page = null;           
            String path = getActionParameter(requestContext, "path");
            if (path == null)
            {
                page = requestContext.getPage().getPageOrTemplate();
            }
            else
            {
                if (!method.equals("add"))
                {
                    if (path.endsWith(Page.DOCUMENT_TYPE))
                    {
                        page = pageManager.getPage(path);
                    }
                    else if (path.endsWith(DynamicPage.DOCUMENT_TYPE))
                    {
                        page = pageManager.getDynamicPage(path);
                    }
                    else
                    {
                        success = false;
                        resultMap.put(REASON, "Can't lookup page by document type: " + path);               
                        return success;                       
                    }
                }
                else
                {
                    if (pageManager.pageExists(path) || pageManager.dynamicPageExists(path))
                    {
                        success = false;
                        resultMap.put(REASON, "Can't create: Page already exists: " + path);               
                        return success;               
                    }
                }
            }
            if (page == null)
            {
                throw new AJAXException("Missing current page or 'path' parameter");
            }
           
            if (method.equals("info"))
            {
                count = updateInformation(requestContext, resultMap, page, path);
            }
            else if (method.equals("add-meta"))
            {
                count = insertMetadata(requestContext, resultMap, page);
            }
            else if (method.equals("update-meta"))
            {
                count = updateMetadata(requestContext, resultMap, page);
            }
            else if (method.equals("remove-meta"))
            {
                count = removeMetadata(requestContext, resultMap, page);
            }
            else if (method.equals("add-secref"))
            {
                count = insertSecurityReference(requestContext, resultMap, page);
            }
            else if (method.equals("update-secref"))
            {
                count = updateSecurityReference(requestContext, resultMap, page);
            }                       
            else if (method.equals("remove-secref"))
            {
                count = removeSecurityReference(requestContext, resultMap, page);
            }
            else if (method.equals("remove-secdef"))
            {
                count = removeSecurityDef(requestContext, resultMap, page);
            }           
            else if (method.equals("add"))
            {
                page = pageManager.newPage(path);
                page.setTitle(getActionParameter(requestContext, TITLE));
                String s = getActionParameter(requestContext, SHORT_TITLE );
                if (!isBlank(s))
                    page.setShortTitle(s);
                String l = getActionParameter(requestContext, DEFAULT_LAYOUT);
                if (!isBlank(l) && (page.getRootFragment() instanceof Fragment))
                {
                    Fragment rootFragment = (Fragment)page.getRootFragment();
                    rootFragment.setName(getActionParameter(requestContext, DEFAULT_LAYOUT));
                }
                count++;               
            }
            else if (method.equals("copy"))
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

        // valves/decorators latently selects the page and builds
        // menus from the user site view; the managed page accessed
        // here is the raw selected page as returned by the
        // page manager component; accessing the managed page here
        // selects the current page for the request
        BaseFragmentsElement managedPageOrTemplate = requestContext.getManagedPageOrTemplate();
        PageTemplate managedPageTemplate = requestContext.getManagedPageTemplate();
        Map managedFragmentDefinitions = requestContext.getManagedFragmentDefinitions();
        ContentPage contentPage = pageLayoutComponent.newContentPage(managedPageOrTemplate, managedPageTemplate, managedFragmentDefinitions);
        request.setPage(contentPage);
        request.setProfileLocators(requestContext.getLocators());
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

            {
                throw new IllegalArgumentException("Only page fragments can be modified");
            }

            // retrieve current page or template and fragment from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentFragmentImpl.getPageOrTemplate().getPath());
            BaseFragmentElement parentFragment = pageOrTemplate.getFragmentById(contentFragmentImpl.getFragment().getId());
            if (!(parentFragment instanceof Fragment))
            {
                throw new IllegalArgumentException("New fragment cannot be added to parent fragment");
            }
            Fragment fragment = (Fragment)parentFragment;
View Full Code Here

Examples of org.apache.jetspeed.om.page.BaseFragmentsElement

            {
                throw new IllegalArgumentException("Page root content fragment not found or is locked");               
            }

            // retrieve current page or template and root fragment from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentPage.getPageOrTemplate().getPath());
            BaseFragmentElement rootFragment = pageOrTemplate.getRootFragment();
            if (!(rootFragment instanceof Fragment))
            {
                throw new IllegalArgumentException("New Fragment cannot be added to page root fragment");               
            }
            Fragment fragment = (Fragment)rootFragment;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.