Search in sources :

Example 86 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class PortletExecutionManager method checkWorkerCompletion.

/** Checks to see if a worker has been retrieved (not orphaned) and if it is complete. */
protected void checkWorkerCompletion(HttpServletRequest request, IPortletRenderExecutionWorker portletRenderExecutionWorker) {
    if (!portletRenderExecutionWorker.isRetrieved()) {
        final IPortletWindowId portletWindowId = portletRenderExecutionWorker.getPortletWindowId();
        final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        this.logger.warn("Portlet worker started but never retrieved for {}, worker {}." + " If random portlet fnames it may be users switching tabs before page is done rendering" + " (would see separate log message with java.net.SocketException on socket write)." + " If repeatedly occurring with one portlet fname your theme layout xsl may not be including" + " a portlet present in your layout xml files (see" + " http://jasig.275507.n4.nabble.com/Portlet-worker-started-but-never-retrieved-td4580698.html)", portletWindow, portletRenderExecutionWorker);
        try {
            portletRenderExecutionWorker.get(0);
        } catch (Exception e) {
        //Ignore exception here, we just want to get this worker to complete
        }
    }
    if (!portletRenderExecutionWorker.isComplete()) {
        cancelWorker(request, portletRenderExecutionWorker);
    }
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IOException(java.io.IOException) MaintenanceModeException(org.apereo.portal.portlets.error.MaintenanceModeException)

Example 87 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class PortletDelegationLocatorImpl method getRequestDispatcher.

/* (non-Javadoc)
     * @see org.apereo.portal.api.portlet.PortletDelegationLocator#getRequestDispatcher(org.apereo.portal.portlet.om.IPortletWindowId)
     */
@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);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPerson(org.apereo.portal.security.IPerson) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 88 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class MarketplaceSearchService method getSearchResults.

/**
     * Returns a list of search results that pertain to the marketplace query is the query to search
     * will search name, title, description, fname, and captions
     */
@Override
public SearchResults getSearchResults(PortletRequest request, SearchRequest query) {
    final String queryString = query.getSearchTerms().toLowerCase();
    final List<IPortletDefinition> portlets = portletDefinitionRegistry.getAllPortletDefinitions();
    final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    final SearchResults results = new SearchResults();
    for (IPortletDefinition portlet : portlets) {
        if (this.matches(queryString, new MarketplacePortletDefinition(portlet, this.marketplaceService, this.portletCategoryRegistry))) {
            final SearchResult result = new SearchResult();
            result.setTitle(portlet.getTitle());
            result.setSummary(portlet.getDescription());
            result.getType().add("marketplace");
            final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(httpServletRequest, portlet.getFName());
            // If user does not have browse permission, exclude the portlet.
            if (portletWindow != null && authorizationService.canPrincipalBrowse(authorizationService.newPrincipal(request.getRemoteUser(), EntityEnum.PERSON.getClazz()), portlet)) {
                final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
                final IPortalUrlBuilder portalUrlBuilder = this.portalUrlProvider.getPortalUrlBuilderByPortletFName(httpServletRequest, portlet.getFName(), UrlType.RENDER);
                final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
                portletUrlBuilder.setWindowState(PortletUtils.getWindowState("maximized"));
                result.setExternalUrl(portalUrlBuilder.getUrlString());
                PortletUrl url = new PortletUrl();
                url.setType(PortletUrlType.RENDER);
                url.setPortletMode("VIEW");
                url.setWindowState("maximized");
                PortletUrlParameter actionParam = new PortletUrlParameter();
                actionParam.setName("action");
                actionParam.getValue().add("view");
                url.getParam().add(actionParam);
                PortletUrlParameter fNameParam = new PortletUrlParameter();
                fNameParam.setName("fName");
                fNameParam.getValue().add(portlet.getFName());
                url.getParam().add(fNameParam);
                result.setPortletUrl(url);
                //Add the result to list to return
                results.getSearchResult().add(result);
            }
        }
    }
    return results;
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) SearchResult(org.apereo.portal.search.SearchResult) SearchResults(org.apereo.portal.search.SearchResults) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) HttpServletRequest(javax.servlet.http.HttpServletRequest) PortletUrlParameter(org.apereo.portal.search.PortletUrlParameter) PortletUrl(org.apereo.portal.search.PortletUrl) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Aggregations

IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)88 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)32 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)32 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)24 HttpServletRequest (javax.servlet.http.HttpServletRequest)14 IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)12 IUserInstance (org.apereo.portal.user.IUserInstance)12 List (java.util.List)10 IPortletEntityId (org.apereo.portal.portlet.om.IPortletEntityId)10 IPortletUrlBuilder (org.apereo.portal.url.IPortletUrlBuilder)9 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)9 IOException (java.io.IOException)8 IUserLayoutManager (org.apereo.portal.layout.IUserLayoutManager)7 WindowState (javax.portlet.WindowState)6 IUserPreferencesManager (org.apereo.portal.IUserPreferencesManager)6 IPortalUrlBuilder (org.apereo.portal.url.IPortalUrlBuilder)6 LinkedHashMap (java.util.LinkedHashMap)5 Locale (java.util.Locale)5 PortletException (javax.portlet.PortletException)5 PortletMode (javax.portlet.PortletMode)5