Package org.apache.jetspeed.om.page

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


        return user + mode + context.getPage().getId();       
    }
   
    public void invalidate(RequestContext context)
    {
        ContentPage page = context.getPage();
        ContentCacheKey themeContentCacheKey = createCacheKey(context, page.getId());
        CacheElement themeCacheElem = get(themeContentCacheKey);
       
        if (themeCacheElem != null)
        {
            Theme theme = (Theme) themeCacheElem.getContent();
View Full Code Here


    @Path("/page/")
    public ContentPageBean getContentPage(@Context HttpServletRequest servletRequest,
                                          @Context UriInfo uriInfo)
    {
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.VIEW);
        }
        catch (SecurityException e)
View Full Code Here

        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment id not specified"));
        }
       
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.VIEW);
        }
        catch (SecurityException e)
        {
            throw new WebApplicationException(e, Status.FORBIDDEN);
        }
        ContentFragment contentFragment = contentPage.getFragmentById(fragmentId);
       
        if (contentFragment == null)
        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment not found with the specified id: " + fragmentId));
        }
View Full Code Here

        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment type and name not specified"));
        }
       
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.EDIT);
        }
        catch (SecurityException e)
        {
            throw new WebApplicationException(e, Status.FORBIDDEN);
        }
       
        int row = NumberUtils.toInt(rowParam, -1);
        int col = NumberUtils.toInt(colParam, -1);
        boolean minRowsColumn = BooleanUtils.toBoolean(minRowsColumnParam);
       
        try
        {
            ContentFragment contentFragment = pageLayoutComponent.addPortlet(contentPage, fragmentType, fragmentName);
            String addedContentFragmentId = contentFragment.getId();
           
            ContentFragment layoutFragment = null;
           
            if (col == -1 && minRowsColumn)
            {
                layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), addedContentFragmentId);
                col = getMinRowsColumnIndex(layoutFragment);
            }
           
            if (row != -1 || col != -1)
            {
                pageLayoutComponent.updateRowColumn(contentFragment, row, col);
            }
           
            if (layoutFragment == null)
            {
                layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), addedContentFragmentId);
            }
           
            PortletPlacementContext ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
            // synchronize back to the page layout root fragment
            contentPage = ppc.syncPageFragments();
View Full Code Here

        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment id not specified"));
        }
       
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.EDIT);
        }
        catch (SecurityException e)
        {
            throw new WebApplicationException(e, Status.FORBIDDEN);
        }
        ContentFragment contentFragment = contentPage.getFragmentById(fragmentId);
       
        if (contentFragment == null)
        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment not found with the specified id: " + fragmentId));
        }
       
        ContentFragment layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), fragmentId);
       
        if (layoutFragment == null)
        {
            throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found for the fragment: " + fragmentId));
        }
View Full Code Here

        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment id not specified"));
        }
       
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.EDIT);
        }
        catch (SecurityException e)
        {
            throw new WebApplicationException(e, Status.FORBIDDEN);
        }
        ContentFragment contentFragment = contentPage.getFragmentById(fragmentId);
       
        if (contentFragment == null)
        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment not found with the specified id: " + fragmentId));
        }
       
        if (!StringUtils.isBlank(direction))
        {
            direction = direction.trim();
           
            ContentFragment layoutFragment = null;
           
            if (!StringUtils.isBlank(layoutFragmentId))
            {
                layoutFragment = contentPage.getFragmentByFragmentId(layoutFragmentId);
               
                if (layoutFragment == null)
                {
                    throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found with the specified id: " + layoutFragmentId));
                }
            }
            else
            {
                layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), fragmentId );
               
                if (layoutFragment == null)
                {
                    throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found for the fragment: " + fragmentId));
                }
            }
           
            PortletPlacementContext ppc = null;
           
            try
            {
                ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
               
                if ("left".equals(direction))
                {
                    ppc.moveLeft(contentFragment);
                }
                else if ("right".equals(direction))
                {
                    ppc.moveRight(contentFragment);
                }
                else if ("up".equals(direction))
                {
                    ppc.moveUp(contentFragment);
                }
                else if ("down".equals(direction))
                {
                    ppc.moveDown(contentFragment);
                }
                else
                {
                    throw new WebApplicationException(new IllegalArgumentException("Invalid direction: " + direction));
                }
               
                // synchronize back to the page layout root fragment
                contentPage = ppc.syncPageFragments(PageLayoutComponent.USER_PROPERTY_SCOPE, null);
            }
            catch (PortletPlacementException e)
            {
                throw new WebApplicationException(e);
            }
        }
        else if (!StringUtils.isBlank(rowParam) && !StringUtils.isBlank(colParam))
        {
            int row = NumberUtils.toInt(rowParam, -1);
            int col = NumberUtils.toInt(colParam, -1);
            float posHeight = NumberUtils.toFloat(posHeightParam, -1.0f);
           
            if (row != -1 && col != -1 && (contentFragment.getLayoutRow() != row || contentFragment.getLayoutColumn() != col))
            {
                try
                {
                    ContentFragment layoutFragment = null;
                    boolean attach = false;
                    if (!StringUtils.isBlank(layoutFragmentId) && layoutFragmentId.equals("attach"))
                    {
                      layoutFragmentId = null;
                      attach = true;
                    }
                    if (!StringUtils.isBlank(layoutFragmentId))
                    {
                        layoutFragment = contentPage.getFragmentByFragmentId(layoutFragmentId);
                       
                        if (layoutFragment == null)
                        {
                            throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found with the specified id: " + layoutFragmentId));
                        }
                    }
                    else
                    {
                        layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), fragmentId);
                       
                        if (layoutFragment == null)
                        {
                            throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found for the fragment: " + fragmentId));
                        }
                    }
                   
                    PortletPlacementContext ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
                    Coordinate coordinate = new CoordinateImpl(0, 0, col, row);
                    ppc.moveAbsolute(contentFragment, coordinate);
                   
                    if (posHeight != -1.0f)
                    {
                        pageLayoutComponent.updatePosition(contentFragment, -1.0f, -1.0f, -1.0f, -1.0f, posHeight, PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                    }
                   
                    // synchronize back to the page layout root fragment
                    contentPage = ppc.syncPageFragments(PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                    if (attach)
                      pageLayoutComponent.updateStateMode(contentFragment, JetspeedActions.NORMAL, null, PageLayoutComponent.USER_PROPERTY_SCOPE, null);                   
                }
                catch (Exception e)
                {
                    throw new WebApplicationException(e);
                }
            }
            else if (!StringUtils.isBlank(layoutFragmentId) && layoutFragmentId.equals("attach"))
            {
                pageLayoutComponent.updateStateMode(contentFragment, JetspeedActions.NORMAL, null, PageLayoutComponent.USER_PROPERTY_SCOPE, null);                   
            }           
        }
        else
        {
            float posX = NumberUtils.toFloat(posXParam, -1.0f);
            float posY = NumberUtils.toFloat(posYParam, -1.0f);
            float posZ = NumberUtils.toFloat(posZParam, -1.0f);
            float posWidth = NumberUtils.toFloat(posWidthParam, -1.0f);
            float posHeight = NumberUtils.toFloat(posHeightParam, -1.0f);
           
            try
            {
                pageLayoutComponent.updatePosition(contentFragment, posX, posY, posZ, posWidth, posHeight, PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                pageLayoutComponent.updateStateMode(contentFragment, JetspeedActions.DETACH, null, PageLayoutComponent.USER_PROPERTY_SCOPE, null);
                if (layoutFragmentId != null && layoutFragmentId.equals("detach"))
                {
                    // first time detach, reallocate column and move it to the back
                    ContentFragment layoutFragment = getParentFragment(contentPage.getNonTemplateRootFragment(), fragmentId);                   
                    if (layoutFragment == null)
                    {
                        throw new WebApplicationException(new IllegalArgumentException("Layout fragment not found for the fragment: " + fragmentId));
                    }                   
                    PortletPlacementContext ppc = new PortletPlacementContextImpl(contentPage, portletRegistry, layoutFragment);
View Full Code Here

        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment id not specified"));
        }
       
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.EDIT);
        }
        catch (SecurityException e)
        {
            throw new WebApplicationException(e, Status.FORBIDDEN);
        }
        ContentFragment contentFragment = contentPage.getFragmentById(fragmentId);
       
        if (contentFragment == null)
        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment not found with the specified id: " + fragmentId));
        }
View Full Code Here

        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment id not specified"));
        }
       
        RequestContext requestContext = (RequestContext) servletRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
        ContentPage contentPage = null;
        try
        {
            contentPage = getContentPage(requestContext, JetspeedActions.VIEW);
        }
        catch (SecurityException e)
        {
            throw new WebApplicationException(e, Status.FORBIDDEN);
        }
        ContentFragment contentFragment = contentPage.getFragmentById(fragmentId);
       
        if (contentFragment == null)
        {
            throw new WebApplicationException(new IllegalArgumentException("Fragment not found with the specified id: " + fragmentId));
        }
View Full Code Here

            {
                throw new Exception("fragment id not provided");
            }
            resultMap.put(FRAGMENTID, fragmentId);
           
            ContentPage page = requestContext.getPage();           
            ContentFragment fragment = page.getFragmentById(fragmentId);
           
            if ( fragment == null )
            {
              throw new Exception( "fragment specified by id cannot be found" );
            }
            String requestedState = getActionParameter(requestContext, WINDOW_STATE);
            String requestedMode = getActionParameter(requestContext, PORTLET_MODE);   
            if ( "layout".equals( fragment.getType() ) )
            {
              if ( ! fragment.getId().equals( page.getRootFragment().getId() ) )
              {
                throw new Exception( "for layout fragments, change action applies to only to the root layout fragment (i.e. it does not apply to nested layout fragments)" );
              }
              PageActionAccess pageActionAccess = (PageActionAccess)requestContext.getAttribute( PortalReservedParameters.PAGE_EDIT_ACCESS_ATTRIBUTE );
              if ( pageActionAccess == null )
View Full Code Here

     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.profiler.rules.RuleCriterion)
     */
    public String resolve(RequestContext context, RuleCriterion criterion)
    {       
        String path = null;
        ContentPage page = context.getPage();
       
        if (page != null)
        {
            path = page.getId();
        }
        else
        {
            path = context.getPath();
        }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.ContentPage

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.