Examples of IPortletWindow


Examples of org.jasig.portal.portlet.om.IPortletWindow

        final MockHttpServletRequest request = new MockHttpServletRequest();
        request.setAttribute(PortletHttpServletRequestWrapper.ATTRIBUTE__HTTP_SERVLET_REQUEST, request);
        request.setRemoteAddr("1.2.3.4");
        request.setMethod("POST");
       
        final IPortletWindow portletWindow = EasyMock.createMock(IPortletWindow.class);
       
        final IPortalRequestUtils portalRequestUtils = EasyMock.createMock(IPortalRequestUtils.class);
        EasyMock.expect(portalRequestUtils.getOriginalPortletAdaptorRequest(request)).andReturn(request);
       
        EasyMock.replay(portletWindow, portalRequestUtils);
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

            final IPersonAttributes personAttributes = this.personAttributeDao.getPerson(remoteUser);
            if (personAttributes == null) {
                return Collections.emptyMap();
            }
           
            final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
            final List<UserAttributeDD> expectedUserAttributes = this.getExpectedUserAttributes(httpServletRequest, portletWindow);
           
            final Map<String, List<Object>> portletMultivaluedAttributes = new HashMap<String, List<Object>>(expectedUserAttributes.size());
           
            //Copy expected attributes to the USER_INFO Map
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

    @SuppressWarnings("unchecked")
  public boolean isPasswordRequested(PortletRequest request, PortletWindow plutoPortletWindow) throws PortletContainerException {

      // get the list of requested user attributes
        final HttpServletRequest httpServletRequest = this.portalRequestUtils.getOriginalPortletAdaptorRequest(request);
        final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
        final IPortletEntity portletEntity = this.portletWindowRegistry.getParentPortletEntity(httpServletRequest, portletWindow.getPortletWindowId());
        final IPortletDefinition portletDefinition = this.portletEntityRegistry.getParentPortletDefinition(portletEntity.getPortletEntityId());
        final PortletAppDD portletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinition.getPortletDefinitionId());
       
        // check to see if the proxy ticket key is one of the requested user attributes
        List<UserAttributeDD> requestedUserAttributes = portletApplicationDescriptor.getUserAttributes();
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

        }
       
        //Determine the appropriate portlet window ID
        final IPerson person = userInstance.getPerson();
        final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreatePortletEntity(portletDefinition.getPortletDefinitionId(), portletNodeId, person.getID());
        final IPortletWindow defaultPortletWindow = this.portletWindowRegistry.createDefaultPortletWindow(request, portletEntity.getPortletEntityId());
        final IPortletWindowId portletWindowId = this.portletWindowRegistry.createTransientPortletWindowId(request, defaultPortletWindow.getPortletWindowId());
       
        return this.getPortletUrl(request, portletWindowId);
    }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

        Validate.notNull(portalPortletUrl, "IPortalPortletUrl was null");
        Validate.notNull(portletWindowId, "IPortletWindowId was null");
      
        final StringBuilder url = this.getUrlBase(request);
       
        final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(portletWindow.getPortletEntityId());
       
        //Add folder information if available: /tabId
        final String channelSubscribeId = portletEntity.getChannelSubscribeId();
        // if not a transient node, we need to lookup user layout information
        if (!channelSubscribeId.startsWith(TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX)) {
            final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
            final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
            final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
            final IUserLayout userLayout = userLayoutManager.getUserLayout();
           
            final XPathExpression findChannelTabExpression = this.getFindChannelTabIdExpression(channelSubscribeId);
            final String tabId = userLayout.findNodeId(findChannelTabExpression);
           
            //Add folder ID of parent tab if it exists
            if (tabId != null) {
                final String folderId = this.verifyFolderId(request, tabId);
                url.append(folderId);
                url.append("/");
            }
        }
       
        //Add state information
        final WindowState requestedWindowState = portalPortletUrl.getWindowState();
        final WindowState currentWindowState = portletWindow.getWindowState();
        final WindowState urlWindowState = requestedWindowState != null ? requestedWindowState : currentWindowState;
     
        String windowStateString = UrlState.NORMAL.toString().toLowerCase();
        if (WindowState.MAXIMIZED.equals(urlWindowState)) {
            windowStateString = UrlState.MAX.toString().toLowerCase();
        }
        else if (IPortletAdaptor.DETACHED.equals(urlWindowState)) {
            windowStateString = UrlState.DETACHED.toString().toLowerCase();
        }
        else if (IPortletAdaptor.EXCLUSIVE.equals(urlWindowState)) {
            windowStateString = UrlState.EXCLUSIVE.toString().toLowerCase();
        }
        else {
            this.logger.warn("Unknown WindowState '" + urlWindowState + "' specified for portlet window " + portletWindow + ", defaulting to NORMAL");
        }
        url.append(windowStateString);
       
        //Add channel information: /fname.chanid
        final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinition(portletEntity.getPortletDefinitionId());
        final IChannelDefinition channelDefinition = portletDefinition.getChannelDefinition();
        final String fname = channelDefinition.getFName();
        final String validFname = FunctionalNameType.INVALID_CHARS_PATTERN.matcher(fname).replaceAll("_");
        url.append("/").append(validFname).append(".").append(channelSubscribeId);
       
        //File part
        if (portalPortletUrl.isAction()) {
            url.append("/action.uP");
        }
        else {
            url.append("/render.uP");
        }
        final String encoding = this.getEncoding(request);
       
        //Query String 
        //Target portlet window info
        this.encodeAndAppend(url.append("?"), encoding, PARAM_REQUEST_TARGET, portletWindowId.getStringId());
         
        //Portlet mode info
        final PortletMode portletMode = portalPortletUrl.getPortletMode();
        if (portletMode != null && !portletMode.equals(portletWindow.getPortletMode())) {
            this.encodeAndAppend(url.append("&"), encoding, PARAM_PORTLET_MODE, portletMode.toString());
        }
       
        //Add window state param for switching between normal and maximized
        if (requestedWindowState != null && !requestedWindowState.equals(currentWindowState)
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

        expect(mockUser.getPreferencesManager()).andReturn(mockUserPreferencesManager).times(2);
        replay(mockUser);
        IPortletEntityId mockPortletEntityId = createMock(IPortletEntityId.class);
        expect(mockPortletEntityId.getStringId()).andReturn(details.getChannelId());
        replay(mockPortletEntityId);
        IPortletWindow mockPortletWindow = createMock(IPortletWindow.class);
        expect(mockPortletWindow.getPortletEntityId()).andReturn(mockPortletEntityId);
        expect(mockPortletWindow.getWindowState()).andReturn(details.getWindowState());
        expect(mockPortletWindow.getPortletMode()).andReturn(details.getPortletMode());
        replay(mockPortletWindow);
       
        IPortletDefinitionId mockPortletDefinitionId = createMock(IPortletDefinitionId.class);
        replay(mockPortletDefinitionId);
        IChannelDefinition mockChannelDefinition = createMock(IChannelDefinition.class);
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

        final String delegateWindowIdStr = request.getParameter(PARAM_DELEGATE_PREFIX + controlNamespace);
        if (delegateWindowIdStr != null) {
            final IPortletWindowId delegateWindowId = this.portletWindowRegistry.getPortletWindowId(delegateWindowIdStr);
           
            //Verify delegation change
            final IPortletWindow delegateWindow = this.portletWindowRegistry.getPortletWindow(request, delegateWindowId);
            final IPortletWindowId delegationParentId = delegateWindow.getDelegationParent();
            if (delegationParentId == null) {
                throw new IllegalArgumentException("Delegate window '" + delegateWindowId + "' has no parent. Parent specified in the URL is '" + portletWindowId + "'");
            }
            else if (!portletWindowId.equals(delegationParentId)) {
                throw new IllegalArgumentException("Parent '" + delegationParentId + "' of delegate window '" + delegateWindowId + "' is not the parent specified in the URL: '" + portletWindowId + "'");
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

        }
       
        //Determine the appropriate portlet window ID
        final IPerson person = userInstance.getPerson();
        final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreatePortletEntity(portletDefinition.getPortletDefinitionId(), channelSubscribeId, person.getID());
        final IPortletWindow defaultPortletWindow = this.portletWindowRegistry.createDefaultPortletWindow(request, portletEntity.getPortletEntityId());

        return new UrlTarget(
                this.portletWindowRegistry.createTransientPortletWindowId(request, defaultPortletWindow.getPortletWindowId()),
                true);
    }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

        final String encoding = this.getEncoding(request);
       
        //Look to see if the window is being delegated to, if so recurse to the parent for URL generation first
        final IPortletWindowId delegationParentId = portletWindow.getDelegationParent();
        if (delegationParentId != null) {
            final IPortletWindow delegateParent = this.portletWindowRegistry.getPortletWindow(request, delegationParentId);
           
            PortletUrl parentUrl = this.portletDelegationManager.getParentPortletUrl(request, delegationParentId);
            if (parentUrl == null) {
                parentUrl = new PortletUrl(delegationParentId);
                parentUrl.setWindowState(delegateParent.getWindowState());
                parentUrl.setPortletMode(delegateParent.getPortletMode());
                parentUrl.setParameters(delegateParent.getRequestParameters());
            }
           
            //Parent URLs MUST be in the same type as the child
            parentUrl.setRequestType(portletUrl.getRequestType());
           
            this.generatePortletUrl(request, delegateParent, portletWindow.getPortletWindowId(), parentUrl, url);
        }
       
        // TODO Need to decide how to deal with 'secure' URL requests

        final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
        final IPortletEntity parentPortletEntity = this.portletWindowRegistry.getParentPortletEntity(request, portletWindowId);
        final String channelSubscribeId = parentPortletEntity.getChannelSubscribeId();

        WindowState windowState = portletUrl.getWindowState();
        PortletMode portletMode = portletUrl.getPortletMode();
       
        final WindowState previousWindowState = portletWindow.getWindowState();
        final PortletMode previousPortletMode = portletWindow.getPortletMode();
       
        //Only do this stuff for the top level window
        if (delegationParentId == null) {
            //Get the channel runtime data from the request attributes, it should have been set there by the portlet adapter
            final ChannelRuntimeData channelRuntimeData = (ChannelRuntimeData)request.getAttribute(IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA);
            if (channelRuntimeData == null) {
                throw new IllegalStateException("No ChannelRuntimeData was found as a request attribute for key '" + IPortletAdaptor.ATTRIBUTE__RUNTIME_DATA + "' on request '" + request + "'");
            }
           
            // Determine the base path for the URL
            // If the next state is EXCLUSIVE or there is no state change and the current state is EXCLUSIVE use the worker URL base
            if (IPortletAdaptor.EXCLUSIVE.equals(windowState) || (windowState == null && IPortletAdaptor.EXCLUSIVE.equals(previousWindowState))) {
                final String urlBase = channelRuntimeData.getBaseWorkerURL(UPFileSpec.FILE_DOWNLOAD_WORKER);
                url.append(urlBase);
            }
            //In detached, need to make sure the URL is right
            else if (IPortletAdaptor.DETACHED.equals(windowState) || (windowState == null && IPortletAdaptor.DETACHED.equals(previousWindowState))) {
                final UPFileSpec upFileSpec = new UPFileSpec(channelRuntimeData.getUPFile());
                upFileSpec.setMethodNodeId(channelSubscribeId);
                upFileSpec.setTargetNodeId(channelSubscribeId);
                final String urlBase = upFileSpec.getUPFile();
                url.append(urlBase);
            }
            //Switching back from detached to a normal state
            else if (IPortletAdaptor.DETACHED.equals(previousWindowState) && windowState != null && !previousWindowState.equals(windowState)) {
                final UPFileSpec upFileSpec = new UPFileSpec(channelRuntimeData.getUPFile());
                upFileSpec.setMethodNodeId(UPFileSpec.USER_LAYOUT_ROOT_NODE);
                final String urlBase = upFileSpec.getUPFile();
                url.append(urlBase);
            }
            //No special handling, just use the base action URL
            else {
                final String urlBase = channelRuntimeData.getBaseActionURL();
                url.append(urlBase);
            }
           
            if (this.logger.isTraceEnabled()) {
                this.logger.trace("Using root url base '" + url + "' for " + portletUrl);
            }
        }
       
        //Set the request target, creating a transient window ID if needed
        boolean forceWindowState = false;
        final String portletWindowIdString;
        //If rendering as a delegate just reuse the id (it will always be transient)
        if (delegationParentId != null) {
            portletWindowIdString = portletWindowId.toString();
        }
        //If switching from a non-transient state to a transient state generate a new transient window id
        else if (this.transientWindowStates.contains(windowState) && !this.transientWindowStates.contains(previousWindowState)) {
            final IPortletWindowId transientPortletWindowId = this.portletWindowRegistry.createTransientPortletWindowId(request, portletWindowId);
            portletWindowIdString = transientPortletWindowId.toString();
        }
        //If the window is transient, it is in a transient state and it is switching from a non-transient state
        else if (this.portletWindowRegistry.isTransient(request, portletWindowId) &&
                !this.transientWindowStates.contains(windowState) &&
                (windowState != null || !this.transientWindowStates.contains(previousWindowState))) {
            //Get non-transient version of id
            final IPortletEntityId portletEntityId = portletWindow.getPortletEntityId();
            final IPortletWindowId defaultPortletWindowId = this.portletWindowRegistry.getDefaultPortletWindowId(portletEntityId);
            portletWindowIdString = defaultPortletWindowId.getStringId();
           
            if (windowState == null) {
                final IPortletWindow defaultPortletWindow = this.portletWindowRegistry.getPortletWindow(request, defaultPortletWindowId);
                if (!previousWindowState.equals(defaultPortletWindow.getWindowState())) {
                    forceWindowState = true;
                    windowState = previousWindowState;
                }
                if (!previousPortletMode.equals(defaultPortletWindow.getPortletMode())) {
                    portletMode = previousPortletMode;
                }
            }
        }
        else {
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletWindow

   
    /* (non-Javadoc)
     * @see org.apache.pluto.spi.PortalCallbackService#setResponseProperty(javax.servlet.http.HttpServletRequest, org.apache.pluto.PortletWindow, java.lang.String, java.lang.String)
     */
    public void setResponseProperty(HttpServletRequest request, PortletWindow plutoPortletWindow, String property, String value) {
        final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(request, plutoPortletWindow);
        this.requestPropertiesManager.setResponseProperty(request, portletWindow, property, value);
    }
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.