/* (non-Javadoc)
@see org.apereo.portal.url.IPortalUrlBuilder#getPortletUrlBuilder(org.apereo.portal.portlet.om.IPortletWindowId)
320120
@Override
    public IPortletUrlBuilder getPortletUrlBuilder(IPortletWindowId portletWindowId) {
        IPortletUrlBuilder portletUrlBuilder;

        portletUrlBuilder = this.portletUrlBuilders.get(portletWindowId);
        if (portletUrlBuilder == null) {
            portletUrlBuilder =
                    ConcurrentMapUtils.putIfAbsent(
                            this.portletUrlBuilders,
                            portletWindowId,
                            new PortletUrlBuilder(portletWindowId, this));
        }

        return portletUrlBuilder;
    }
935756
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201808.ProposalLineItemServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201808.ProposalLineItemServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201808.ProposalLineItemServiceSoapBindingStub(new java.net.URL(ProposalLineItemServiceInterfacePort_address), this);
                _stub.setPortName(getProposalLineItemServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
957094
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceSoapBindingStub(new java.net.URL(ReportDefinitionServiceInterfacePort_address), this);
                _stub.setPortName(getReportDefinitionServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
341484
protected PortletRequestInfoImpl getTargetedPortletRequestInfo(
            final PortalRequestInfoImpl portalRequestInfo,
            final PortletRequestInfoImpl targetedPortletRequestInfo,
            final IPortletWindowId targetedPortletWindowId) {

        if (targetedPortletWindowId == null) {
            return targetedPortletRequestInfo;
        }

        return portalRequestInfo.getPortletRequestInfo(targetedPortletWindowId);
    }
263445
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerServiceSoapBindingStub(new java.net.URL(ManagedCustomerServiceInterfacePort_address), this);
                _stub.setPortName(getManagedCustomerServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
543233
@Override
    public WebserviceEndpoint getWebserviceEndpoint(String portComponentName) {
        if (portComponentName == null)
            return null;
        WebserviceEndpoint returnValue = webserviceEndpointTypeMap.get(portComponentName);

        if (returnValue == null && delegate != null)
            return delegate.getWebserviceEndpoint(portComponentName);

        return returnValue;
    }
1151837
@Override
    public IPortalUrlBuilder getPortalUrlBuilderByLayoutNode(
            HttpServletRequest request, String layoutNodeId, UrlType urlType) {
        final IPortletWindowId portletWindowId = getPortletWindowId(request, layoutNodeId);

        return new PortalUrlBuilder(
                this.urlSyntaxProvider, request, layoutNodeId, portletWindowId, urlType);
    }
308964
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.BiddingStrategyServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.BiddingStrategyServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.BiddingStrategyServiceSoapBindingStub(new java.net.URL(BiddingStrategyServiceInterfacePort_address), this);
                _stub.setPortName(getBiddingStrategyServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1073277
@Override
    public PortletDelegationDispatcher getRequestDispatcher(
            PortletRequest portletRequest, IPortletWindowId portletWindowId) {
        final HttpServletRequest request =
                this.portalRequestUtils.getPortletHttpRequest(portletRequest);
        final IPerson person = this.personManager.getPerson(request);

        final IPortletWindow portletWindow =
                this.portletWindowRegistry.getPortletWindow(request, portletWindowId);

        final IPortletWindowId delegationParentId = portletWindow.getDelegationParentId();
        if (delegationParentId == null) {
            throw new IllegalArgumentException(
                    "Portlet window '"
                            + portletWindow
                            + "' is not a delegate window and cannot be delgated to.");
        }

        return new PortletDelegationDispatcherImpl(
                portletWindow,
                person.getID(),
                this.portalRequestUtils,
                this.personManager,
                this.portletRenderer,
                this.portalUrlProvider,
                this.portletDelegationManager);
    }
664993
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.CampaignSharedSetServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.CampaignSharedSetServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.CampaignSharedSetServiceSoapBindingStub(new java.net.URL(CampaignSharedSetServiceInterfacePort_address), this);
                _stub.setPortName(getCampaignSharedSetServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
228786
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201805.ProductPackageItemServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201805.ProductPackageItemServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201805.ProductPackageItemServiceSoapBindingStub(new java.net.URL(ProductPackageItemServiceInterfacePort_address), this);
                _stub.setPortName(getProductPackageItemServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1370309
@Override
    public String getPortletOutput(
            IPortletWindowId portletWindowId,
            HttpServletRequest request,
            HttpServletResponse response) {
        final IPortletRenderExecutionWorker tracker =
                getRenderedPortletBodyWorker(portletWindowId, request, response);
        final long timeout = getPortletRenderTimeout(portletWindowId, request);

        try {
            final String output = tracker.getOutput(timeout);
            return output == null ? "" : output;
        } catch (Exception e) {
            final IPortletFailureExecutionWorker failureWorker =
                    this.portletWorkerFactory.createFailureWorker(
                            request, response, portletWindowId, e);
            // TODO publish portlet error event?
            try {
                failureWorker.submit();
                return failureWorker.getOutput(timeout);
            } catch (Exception e1) {
                logger.error("Failed to render error portlet for: " + portletWindowId, e1);
                return "Error Portlet Unavailable. Please contact your portal administrators.";
            }
        }
    }
348109
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.DraftServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.DraftServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.DraftServiceSoapBindingStub(new java.net.URL(DraftServiceInterfacePort_address), this);
                _stub.setPortName(getDraftServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
192910
protected String verifyPortletWindowId(
            HttpServletRequest request, IPortletWindowId portletWindowId) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
        final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();

        final IPortletWindow portletWindow =
                this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
        if (delegationParentWindowId != null) {
            return verifyPortletWindowId(request, delegationParentWindowId);
        }

        final IPortletEntity portletEntity = portletWindow.getPortletEntity();
        final String channelSubscribeId = portletEntity.getLayoutNodeId();
        final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
        if (node == null) {
            throw new IllegalArgumentException(
                    "No layout node exists for id "
                            + channelSubscribeId
                            + " of window "
                            + portletWindowId);
        }

        return node.getId();
    }
849802
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201811.MobileApplicationServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201811.MobileApplicationServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201811.MobileApplicationServiceSoapBindingStub(new java.net.URL(MobileApplicationServiceInterfacePort_address), this);
                _stub.setPortName(getMobileApplicationServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1032573
protected void addPortletUrlData(
            final HttpServletRequest request,
            final UrlStringBuilder url,
            final UrlType urlType,
            final IPortletUrlBuilder portletUrlBuilder,
            final IPortletWindowId targetedPortletWindowId,
            final boolean statelessUrl) {

        final IPortletWindowId portletWindowId = portletUrlBuilder.getPortletWindowId();
        final boolean targeted = portletWindowId.equals(targetedPortletWindowId);

        IPortletWindow portletWindow = null;

        // The targeted portlet doesn't need namespaced parameters
        final String prefixedPortletWindowId;
        final String suffixedPortletWindowId;
        // Track whether or not we are adding parameters to the URL for non-targeted or delegate
        // portlets.
        boolean addedNonTargetedPortletParam = false;
        if (targeted) {
            prefixedPortletWindowId = "";
            suffixedPortletWindowId = "";
        } else {
            final String portletWindowIdStr = portletWindowId.toString();
            prefixedPortletWindowId = SEPARATOR + portletWindowIdStr;
            suffixedPortletWindowId = portletWindowIdStr + SEPARATOR;

            // targeted portlets can never be delegates (it is always the top most parent that is
            // targeted)
            portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
            final IPortletWindowId delegationParentId = portletWindow.getDelegationParentId();
            if (delegationParentId != null) {
                url.addParameter(
                        PARAM_DELEGATE_PARENT + prefixedPortletWindowId,
                        delegationParentId.getStringId());
                addedNonTargetedPortletParam = true;
            }
        }

        switch (urlType) {
            case RESOURCE:
                {
                    final String cacheability = portletUrlBuilder.getCacheability();
                    if (cacheability != null) {
                        url.addParameter(
                                PARAM_CACHEABILITY + prefixedPortletWindowId, cacheability);
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    final String resourceId = portletUrlBuilder.getResourceId();
                    if (!targeted && resourceId != null) {
                        url.addParameter(PARAM_RESOURCE_ID + prefixedPortletWindowId, resourceId);
                        // We know we are !targeted, but kept the assignement consistent with the
                        // other similar
                        // assignments for clarity.
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    break;
                }
            default:
                {
                    // Add requested portlet mode
                    final PortletMode portletMode = portletUrlBuilder.getPortletMode();
                    if (portletMode != null) {
                        url.addParameter(
                                PARAM_PORTLET_MODE + prefixedPortletWindowId,
                                portletMode.toString());
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    } else if (targeted && statelessUrl) {
                        portletWindow =
                                portletWindow != null
                                        ? portletWindow
                                        : this.portletWindowRegistry.getPortletWindow(
                                                request, portletWindowId);
                        final PortletMode currentPortletMode = portletWindow.getPortletMode();
                        url.addParameter(
                                PARAM_PORTLET_MODE + prefixedPortletWindowId,
                                currentPortletMode.toString());
                        // We know we are targeted, but kept the assignement consistent with the
                        // other similar
                        // assignments for clarity. Will always be a nop.
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    // Add requested window state if it isn't included on the path
                    final WindowState windowState = portletUrlBuilder.getWindowState();
                    if (windowState != null
                            && (!targeted || !PATH_WINDOW_STATES.contains(windowState))) {
                        url.addParameter(
                                PARAM_WINDOW_STATE + prefixedPortletWindowId,
                                windowState.toString());
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    break;
                }
        }

        if (portletUrlBuilder.getCopyCurrentRenderParameters()) {
            url.addParameter(PARAM_COPY_PARAMETERS + suffixedPortletWindowId);
            addedNonTargetedPortletParam = !targeted ? true : addedNonTargetedPortletParam;
        }

        final Map<String, String[]> parameters = portletUrlBuilder.getParameters();
        if (!parameters.isEmpty()) {
            url.addParametersArray(PORTLET_PARAM_PREFIX + suffixedPortletWindowId, parameters);
            addedNonTargetedPortletParam = !targeted ? true : addedNonTargetedPortletParam;
        }

        // UP-4566 If we have added a portlet parameter for a non-targeted (or delegate) portlet add
        // in the
        // additional-portlet parameter to aid in URL parsing later on.  Among other things the
        // practical impact
        // of this is when we do a search which sends an event to all porlets the user has access to
        // which adds a
        // bunch of portletUrlBuilders to the request, we don't add a bunch of unnecessary &PCa
        // parameters to the
        // URL since there are no parameters actually being passed to the searched portlets.
        if (addedNonTargetedPortletParam) {
            url.addParameter(PARAM_ADDITIONAL_PORTLET, portletWindowId.toString());
        }
    }
137355
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201811.ForecastServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201811.ForecastServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201811.ForecastServiceSoapBindingStub(new java.net.URL(ForecastServiceInterfacePort_address), this);
                _stub.setPortName(getForecastServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }