Package org.apache.jetspeed.decoration

Examples of org.apache.jetspeed.decoration.PageActionAccess$ActionAccess


    {
        Page page = requestContext.getPage();
        String key = page.getId();
        boolean loggedOn = requestContext.getRequest().getUserPrincipal() != null;
        boolean anonymous = !loggedOn;
        PageActionAccess pageActionAccess = null;

        Map sessionActions = null;
        synchronized (this)
        {
            sessionActions = (Map) requestContext.getSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY);
            if (sessionActions == null)
            {
                sessionActions = new HashMap();
                requestContext.setSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY, sessionActions);
            }
            else
            {
                pageActionAccess = (PageActionAccess) sessionActions.get(key);
            }
        }
        synchronized (sessionActions)
        {
            if (pageActionAccess == null)
            {
                pageActionAccess = new PageActionAccess(anonymous, page);
                sessionActions.put(key, pageActionAccess);
            }
            else
            {
                pageActionAccess.checkReset(anonymous, page);
            }       
        }
       
        return pageActionAccess;
    }
View Full Code Here


    {
        Page page = requestContext.getPage();
        String key = page.getId();
        boolean loggedOn = requestContext.getRequest().getUserPrincipal() != null;
        boolean anonymous = !loggedOn;
        PageActionAccess pageActionAccess = null;

        Map sessionActions = null;
        synchronized (this)
        {
            sessionActions = (Map) requestContext.getSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY);
            if (sessionActions == null)
            {
                sessionActions = new HashMap();
                requestContext.setSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY, sessionActions);
            }
            else
            {
                pageActionAccess = (PageActionAccess) sessionActions.get(key);
            }
        }
        synchronized (sessionActions)
        {
            if (pageActionAccess == null)
            {
                pageActionAccess = new PageActionAccess(anonymous, page);
                sessionActions.put(key, pageActionAccess);
            }
            else
            {
                pageActionAccess.checkReset(anonymous, page);
            }       
        }
       
        return pageActionAccess;
    }
View Full Code Here

    {
        Page page = requestContext.getPage();
        String key = page.getId();
        boolean loggedOn = requestContext.getRequest().getUserPrincipal() != null;
        boolean anonymous = !loggedOn;
        PageActionAccess pageActionAccess = null;

        Map sessionActions = null;
        synchronized (this)
        {
            sessionActions = (Map) requestContext.getSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY);
            if (sessionActions == null)
            {
                sessionActions = new HashMap();
                requestContext.setSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY, sessionActions);
            }
            else
            {
                pageActionAccess = (PageActionAccess) sessionActions.get(key);
            }
        }
        synchronized (sessionActions)
        {
            if (pageActionAccess == null)
            {
                pageActionAccess = new PageActionAccess(anonymous, page);
                sessionActions.put(key, pageActionAccess);
            }
            else
            {
                pageActionAccess.checkReset(anonymous, page);
            }       
        }
       
        return pageActionAccess;
    }
View Full Code Here

    {
        Page page = requestContext.getPage();
        String key = page.getId();
        boolean loggedOn = requestContext.getRequest().getUserPrincipal() != null;
        boolean anonymous = !loggedOn;
        PageActionAccess pageActionAccess = null;

        Map sessionActions = null;
        synchronized (this)
        {
            sessionActions = (Map) requestContext.getSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY);
            if (sessionActions == null)
            {
                sessionActions = new HashMap();
                requestContext.setSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY, sessionActions);
            }
            else
            {
                pageActionAccess = (PageActionAccess) sessionActions.get(key);
            }
        }
        synchronized (sessionActions)
        {
            if (pageActionAccess == null)
            {
                pageActionAccess = new PageActionAccess(anonymous, page);
                sessionActions.put(key, pageActionAccess);
            }
            else
            {
                pageActionAccess.checkReset(anonymous, page);
            }       
        }
       
        return pageActionAccess;
    }
View Full Code Here

           
            String profiledPath = siteRequestContext.getPage().getPath();
            resultMap.put( PROFILED_PATH, profiledPath );
            putSecurityInformation( resultMap, page );
    
            PageActionAccess pageActionAccess = (PageActionAccess)requestContext.getAttribute( PortalReservedParameters.PAGE_EDIT_ACCESS_ATTRIBUTE );
            Boolean userIsAnonymous = Boolean.TRUE;
            if ( pageActionAccess != null )
              userIsAnonymous = new Boolean( pageActionAccess.isAnonymous() );
            resultMap.put( USER_IS_ANONYMOUS, userIsAnonymous.toString() );
    
            Boolean isPageQualifiedForCreateNewPageOnEdit = Boolean.FALSE;
            if ( ! userIsAnonymous.booleanValue() )
              isPageQualifiedForCreateNewPageOnEdit = new Boolean( isPageQualifiedForCreateNewPageOnEdit( requestContext ) );
View Full Code Here

            {
              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 )
              {
                throw new Exception( "cannot change action for root layout fragment due to null PageActionAccess object" );
              }
              //pageActionAccess.
              PortletWindow window = windowAccessor.getPortletWindow(fragment);
              PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode( window );
              WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState( window );
             
              boolean requestedModeAlreadySet = false;
              if ( requestedMode == null )
                requestedModeAlreadySet = true;
              else
              {
                if ( requestedMode.equals( PortletMode.EDIT.toString() ) )
                {
                  if( pageActionAccess.isEditing() )
                    requestedModeAlreadySet = true;
                  else
                  {
                    if ( pageActionAccess.isEditAllowed())
                    {
                      pageActionAccess.setEditing( true );
                      resultMap.put(STATUS, status);
                      resultMap.put(OLD_PORTLET_MODE, currentMode.toString());
                      resultMap.put(PORTLET_MODE, requestedMode);
                    }
                    else
                    {
                      throw new Exception( "permissions do no allow page edit" );
                    }
                  }
                }
                else if ( requestedMode.equals( PortletMode.VIEW.toString() ) )
                {
                  pageActionAccess.setEditing( false );
                  //if ( currentMode.equals( PortletMode.HELP ) )
                  resultMap.put(STATUS, status);
                  resultMap.put(OLD_PORTLET_MODE, currentMode.toString());
                  resultMap.put(PORTLET_MODE, requestedMode);
                }
View Full Code Here

            {
              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 )
              {
                throw new Exception( "cannot change action for root layout fragment due to null PageActionAccess object" );
              }
              //pageActionAccess.
              PortletWindow window = requestContext.getPortletWindow(fragment);
              if (!window.isValid())
              {
                  throw new Exception("Failed to retrieve Portlet Definition for: "+ fragment.getId() + ", " + fragment.getName());
              }
              PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode( window );
              WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState( window );
             
              boolean requestedModeAlreadySet = false;
              if ( requestedMode == null )
              {
                requestedModeAlreadySet = true;
              }
              else
              {
                if ( requestedMode.equals( PortletMode.EDIT.toString() ) )
                {
                  if( pageActionAccess.isEditing() )
                    requestedModeAlreadySet = true;
                  else
                  {
                    if ( pageActionAccess.isEditAllowed())
                    {
                      pageActionAccess.setEditing( true );
                      resultMap.put(STATUS, status);
                      resultMap.put(OLD_PORTLET_MODE, currentMode.toString());
                      resultMap.put(PORTLET_MODE, requestedMode);
                    }
                    else
                    {
                      throw new Exception( "permissions do no allow page edit" );
                    }
                  }
                }
                else if ( requestedMode.equals( PortletMode.VIEW.toString() ) )
                {
                  pageActionAccess.setEditing( false );
                  //if ( currentMode.equals( PortletMode.HELP ) )
                  resultMap.put(STATUS, status);
                  resultMap.put(OLD_PORTLET_MODE, currentMode.toString());
                  resultMap.put(PORTLET_MODE, requestedMode);
                }
View Full Code Here

    {
        Page page = requestContext.getPage();
        String key = page.getId();
        boolean loggedOn = requestContext.getRequest().getUserPrincipal() != null;
        boolean anonymous = !loggedOn;
        PageActionAccess pageActionAccess = null;

        Map sessionActions = null;
        synchronized (this)
        {
            sessionActions = (Map) requestContext.getSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY);
            if (sessionActions == null)
            {
                sessionActions = new HashMap();
                requestContext.setSessionAttribute(PAGE_ACTION_ACCESS_MAP_SESSION_ATTR_KEY, sessionActions);
            }
            else
            {
                pageActionAccess = (PageActionAccess) sessionActions.get(key);
            }
        }
        synchronized (sessionActions)
        {
            if (pageActionAccess == null)
            {
                pageActionAccess = new PageActionAccess(anonymous, page);
                sessionActions.put(key, pageActionAccess);
            }
            else
            {
                pageActionAccess.checkReset(anonymous, page);
            }       
        }
       
        return pageActionAccess;
    }
View Full Code Here

           
            String profiledPath = siteRequestContext.getPage().getPath();
            resultMap.put( PROFILED_PATH, profiledPath );
            putSecurityInformation( resultMap, page );
    
            PageActionAccess pageActionAccess = (PageActionAccess)requestContext.getAttribute( PortalReservedParameters.PAGE_EDIT_ACCESS_ATTRIBUTE );
            Boolean userIsAnonymous = Boolean.TRUE;
            if ( pageActionAccess != null )
              userIsAnonymous = new Boolean( pageActionAccess.isAnonymous() );
            resultMap.put( USER_IS_ANONYMOUS, userIsAnonymous.toString() );
    
            Boolean isPageQualifiedForCreateNewPageOnEdit = Boolean.FALSE;
            if ( ! userIsAnonymous.booleanValue() )
              isPageQualifiedForCreateNewPageOnEdit = new Boolean( isPageQualifiedForCreateNewPageOnEdit( requestContext ) );
View Full Code Here

            {
              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 )
              {
                throw new Exception( "cannot change action for root layout fragment due to null PageActionAccess object" );
              }
              //pageActionAccess.
              PortletWindow window = requestContext.getPortletWindow(fragment);
              if (!window.isValid())
              {
                  throw new Exception("Failed to retrieve Portlet Definition for: "+ fragment.getId() + ", " + fragment.getName());
              }
              PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode( window );
              WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState( window );
             
              boolean requestedModeAlreadySet = false;
              if ( requestedMode == null )
              {
                requestedModeAlreadySet = true;
              }
              else
              {
                if ( requestedMode.equals( PortletMode.EDIT.toString() ) )
                {
                  if( pageActionAccess.isEditing() )
                    requestedModeAlreadySet = true;
                  else
                  {
                    if ( pageActionAccess.isEditAllowed())
                    {
                      pageActionAccess.setEditing( true );
                      resultMap.put(STATUS, status);
                      resultMap.put(OLD_PORTLET_MODE, currentMode.toString());
                      resultMap.put(PORTLET_MODE, requestedMode);
                    }
                    else
                    {
                      throw new Exception( "permissions do no allow page edit" );
                    }
                  }
                }
                else if ( requestedMode.equals( PortletMode.VIEW.toString() ) )
                {
                  pageActionAccess.setEditing( false );
                  //if ( currentMode.equals( PortletMode.HELP ) )
                  resultMap.put(STATUS, status);
                  resultMap.put(OLD_PORTLET_MODE, currentMode.toString());
                  resultMap.put(PORTLET_MODE, requestedMode);
                }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.decoration.PageActionAccess$ActionAccess

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.