Examples of ContentFragmentImpl


Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

     */
    private ContentFragmentImpl newContentFragment(String parentId, BaseFragmentsElement pageOrTemplate, Map fragmentDefinitions, BaseFragmentsElement definition, FragmentReference fragmentReference, boolean template, Fragment [] fragmentFragment)
    {
        // generate content fragment hierarchy for reference fragment from
        // fragment definition root fragment if located
        ContentFragmentImpl contentFragmentImpl = null;
        FragmentDefinition fragmentDefinition = (FragmentDefinition)((fragmentDefinitions != null) ? fragmentDefinitions.get(fragmentReference.getRefId()) : null);
        if ((fragmentDefinition != null) && (fragmentDefinition.getRootFragment() instanceof Fragment))
        {
            fragmentFragment[0] = (Fragment)fragmentDefinition.getRootFragment();
            String contentFragmentId = parentId+CONTENT_FRAGMENT_ID_SEPARATOR+fragmentFragment[0].getId();               
            contentFragmentImpl = newContentFragment(contentFragmentId, pageOrTemplate, fragmentDefinitions, fragmentDefinition, fragmentFragment[0], definition, fragmentReference, template, true);
        }
        else
        {
            contentFragmentImpl = newContentFragment(parentId, pageOrTemplate, definition, fragmentReference, null, null, template, true);
        }
        contentFragmentImpl.setRefId(fragmentReference.getRefId());
        return contentFragmentImpl;
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

     */
    private ContentFragmentImpl newContentFragment(String parentId, BaseFragmentsElement pageOrTemplate, BaseFragmentsElement definition, FragmentReference fragmentReference)
    {
        // generate content fragment reference for fragment reference
        String contentFragmentId = parentId+CONTENT_FRAGMENT_ID_SEPARATOR+fragmentReference.getId();               
        ContentFragmentImpl contentFragmentImpl = newContentFragment(contentFragmentId, pageOrTemplate, pageOrTemplate, fragmentReference, null, null, false, true);
        contentFragmentImpl.setType(ContentFragment.REFERENCE);
        contentFragmentImpl.setRefId(fragmentReference.getRefId());
        // inherit fragment reference attributes
        mergeContentFragmentAttributes(contentFragmentImpl, fragmentReference);
        // set content fragment security constraints
        setContentFragmentSecurityConstraints(contentFragmentImpl, fragmentReference);
        return contentFragmentImpl;
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

     * @return content fragment hierarchy or null if undefined
     */
    private ContentFragmentImpl newContentFragment(String id, BaseFragmentsElement pageOrTemplate, Map fragmentDefinitions, BaseFragmentsElement definition, Fragment fragment, BaseFragmentsElement referenceDefinition, FragmentReference reference, boolean template, boolean locked)
    {
        // generate content fragment hierarchy for fragment
        ContentFragmentImpl contentFragmentImpl = newContentFragment(id, pageOrTemplate, definition, fragment, referenceDefinition, reference, template, locked);
        contentFragmentImpl.setName(fragment.getName());
        contentFragmentImpl.setType(fragment.getType());

        // generate nested content fragments
        List fragments = fragment.getFragments();
        if (fragments != null)
        {
            Iterator fragmentIter = fragments.iterator();
            while (fragmentIter.hasNext())
            {
                BaseFragmentElement childFragment = (BaseFragmentElement)fragmentIter.next();
                ContentFragmentImpl newContentFragment = newContentFragment(id, pageOrTemplate, fragmentDefinitions, definition, childFragment, template);
                if (newContentFragment != null)
                {
                    contentFragmentImpl.getFragments().add(newContentFragment);
                }
            }
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

     * @return content fragment hierarchy or null if undefined
     */
    private ContentFragmentImpl newContentFragment(String id, BaseFragmentsElement pageOrTemplate, BaseFragmentsElement definition, BaseFragmentElement fragment, BaseFragmentsElement referenceDefinition, FragmentReference reference, boolean template, boolean locked)
    {
        // generate content fragment for fragment
        ContentFragmentImpl contentFragmentImpl = new ContentFragmentImpl(this, id, pageOrTemplate, definition, fragment, referenceDefinition, reference, template, locked);

        log.debug("PageLayoutComponentImpl.newContentFragment(): constructed ContentFragment: id="+id+", template="+template+", locked="+locked);
        return contentFragmentImpl;
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

    // Helper method
    public static ContentPage setupPage()
    {
        // Prepare some fragments
        ContentFragmentImpl a_oLayout = buildFragment("layout", "6", "layout", 0, 0);
        ContentFragmentImpl a_oFrag1 = buildFragment("frag1", "1", "portlet", 0, 0);
        ContentFragmentImpl a_oFrag2 = buildFragment("frag2", "2", "portlet", 0, 1);
        ContentFragmentImpl a_oFrag3 = buildFragment("frag3", "3", "portlet", 1, 0);
        ContentFragmentImpl a_oFrag4 = buildFragment("frag4", "4", "portlet", 1, 1);
        ContentFragmentImpl a_oFrag5 = buildFragment("frag5", "5", "portlet", 1, 2);
       
        a_oLayout.getFragments().add(a_oFrag1);
        a_oLayout.getFragments().add(a_oFrag2);
        a_oLayout.getFragments().add(a_oFrag3);
        a_oLayout.getFragments().add(a_oFrag4);
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

    }

    public static ContentFragmentImpl buildFragment(String p_sName, String p_sId,
            String p_sType, int p_iCol, int p_iRow)
    {
        ContentFragmentImpl a_oFrag = new ContentFragmentImpl(p_sId);
        a_oFrag.setName(p_sName);
        a_oFrag.setType(p_sType);
        a_oFrag.setLayoutColumn(p_iCol);
        a_oFrag.setLayoutRow(p_iRow);
        return a_oFrag;
    }
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

                throw new IllegalArgumentException("Portlet type and name not specified");
            }
           
            // get page root content fragment
            ContentPageImpl contentPageImpl = (ContentPageImpl)contentPage;
            ContentFragmentImpl pageRootContentFragmentImpl = contentPageImpl.getPageRootContentFragment();
            if ((pageRootContentFragmentImpl != null) && pageRootContentFragmentImpl.isLocked())
            {
                pageRootContentFragmentImpl = (ContentFragmentImpl)pageRootContentFragmentImpl.getNonTemplateLayoutFragment();
            }
            if ((pageRootContentFragmentImpl == null) || pageRootContentFragmentImpl.isLocked())
            {
                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(contentPageImpl.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;
            if (!Fragment.LAYOUT.equals(fragment.getType()))
            {
                throw new IllegalArgumentException("New fragment cannot be added to non-layout page root fragment");               
            }
           
            // check for edit permission
            fragment.checkAccess(JetspeedActions.EDIT);
           
            // create fragment and add to layout root fragment
            Fragment newFragment = pageManager.newFragment();
            newFragment.setType(contentFragment.getType());
            newFragment.setName(contentFragment.getName());
            if (!Utils.isNull(row))
            {
                newFragment.setLayoutRow(row);
            }
            if (!Utils.isNull(column))
            {
                newFragment.setLayoutColumn(column);
            }
            fragment.getFragments().add(newFragment);

            // update page in page manager
            updatePage(pageOrTemplate);
           
            // update content page context
            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
            contentFragmentImpl.initialize(this, pageOrTemplate, pageOrTemplate, newFragment, null, null, false, false);
            if (!Utils.isNull(row))
            {
                contentFragmentImpl.setLayoutRow(null, null, row);
            }
            if (!Utils.isNull(column))
            {
                contentFragmentImpl.setLayoutColumn(null, null, column);
            }
            pageRootContentFragmentImpl.getFragments().add(contentFragmentImpl);
            String newContentFragmentId = pageRootContentFragmentImpl.getId()+CONTENT_FRAGMENT_ID_SEPARATOR+contentFragmentImpl.getFragment().getId();
            contentFragmentImpl.setId(newContentFragmentId);           
            return contentFragmentImpl;
        }
        catch (Exception e)
        {
            throw new PageLayoutComponentException("Unexpected exception: "+e, e);
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

            {
                throw new IllegalArgumentException("Fragment definition id not specified");
            }
           
            // validate content fragment
            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
            if (contentFragmentImpl.getDefinition() == null)
            {
                throw new IllegalArgumentException("Transient content fragments are not mutable");
            }           
            if (contentFragmentImpl.isLocked())
            {
                throw new IllegalArgumentException("Locked content fragment is not mutable");
            }
            if (!contentFragmentImpl.getDefinition().getPath().equals(contentFragmentImpl.getPageOrTemplate().getPath()))
            {
                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;
            if (!Fragment.LAYOUT.equals(fragment.getType()))
            {
                throw new IllegalArgumentException("New fragment cannot be added to non-layout parent fragment");               
            }
           
            // check for edit permission
            fragment.checkAccess(JetspeedActions.EDIT);

            // create fragment reference and add to layout fragment
            FragmentReference newFragmentReference = pageManager.newFragmentReference();
            newFragmentReference.setRefId(id);
            if (!Utils.isNull(row))
            {
                newFragmentReference.setLayoutRow(row);
            }
            if (!Utils.isNull(column))
            {
                newFragmentReference.setLayoutColumn(column);
            }
            fragment.getFragments().add(newFragmentReference);

            // update page in page manager
            updatePage(pageOrTemplate);

            // update content context
            ContentFragmentImpl newContentFragmentImpl = newContentFragment(contentFragmentImpl.getId(), pageOrTemplate, pageOrTemplate, newFragmentReference);
            contentFragmentImpl.getFragments().add(newContentFragmentImpl);
            return newContentFragmentImpl;
        }
        catch (Exception e)
        {
View Full Code Here

Examples of org.apache.jetspeed.om.page.impl.ContentFragmentImpl

                throw new IllegalArgumentException("Fragment definition id not specified");
            }
           
            // get page root content fragment
            ContentPageImpl contentPageImpl = (ContentPageImpl)contentPage;
            ContentFragmentImpl pageRootContentFragmentImpl = contentPageImpl.getPageRootContentFragment();
            if ((pageRootContentFragmentImpl != null) && pageRootContentFragmentImpl.isLocked())
            {
                pageRootContentFragmentImpl = (ContentFragmentImpl)pageRootContentFragmentImpl.getNonTemplateLayoutFragment();
            }
            if ((pageRootContentFragmentImpl == null) || pageRootContentFragmentImpl.isLocked())
            {
                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;
            if (!Fragment.LAYOUT.equals(fragment.getType()))
            {
                throw new IllegalArgumentException("New Fragment cannot be added to non-layout page root fragment");               
            }

            // check for edit permission
            fragment.checkAccess(JetspeedActions.EDIT);
           
            // create fragment reference and add to layout root fragment
            FragmentReference newFragmentReference = pageManager.newFragmentReference();
            newFragmentReference.setRefId(id);
            fragment.getFragments().add(newFragmentReference);

            // update page in page manager
            updatePage(pageOrTemplate);

            // update content page context
            ContentFragmentImpl newContentFragmentImpl = newContentFragment(pageRootContentFragmentImpl.getId(), pageOrTemplate, pageOrTemplate, newFragmentReference);
            pageRootContentFragmentImpl.getFragments().add(newContentFragmentImpl);
            return newContentFragmentImpl;
        }
        catch (Exception e)
        {
View Full Code Here

Examples of org.apache.jetspeed.om.page.psml.ContentFragmentImpl

    }

    public void testWindowAccess() throws Exception
    {
        List windows = new ArrayList();
        ContentFragment f1 = new ContentFragmentImpl((Fragment) fragMock.proxy(), new HashMap());
        MutablePortletEntity entity = (MutablePortletEntity) entityMock.proxy();
        CompositeWindowList windowList = (CompositeWindowList) windowListMock.proxy();
        entityAccessMock.expects(new InvokeAtLeastOnceMatcher()).method("getPortletEntityForFragment")
                .withAnyArguments().will(new ReturnStub(entity));
        fragMock.expects(new InvokeAtLeastOnceMatcher()).method("getId").withNoArguments()
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.