Search in sources :

Example 46 with IPortletEntity

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

the class PortletCacheControlServiceImpl method purgeCachedPortletData.

@Override
public boolean purgeCachedPortletData(IPortletWindowId portletWindowId, HttpServletRequest httpRequest) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(httpRequest, portletWindowId);
    final IPortletEntity entity = portletWindow.getPortletEntity();
    final IPortletDefinitionId definitionId = entity.getPortletDefinitionId();
    final HttpSession session = httpRequest.getSession();
    int purgeCount = 0;
    // Remove all publicly cached data
    purgeCount += this.taggedCacheEntryPurger.purgeCacheEntries(PublicPortletCacheKey.createTag(definitionId));
    // Remove all privately cached data
    purgeCount += this.taggedCacheEntryPurger.purgeCacheEntries(PrivatePortletCacheKey.createTag(session.getId(), portletWindowId));
    logger.debug("Purging all cached data for {} removed {} keys", portletWindow, purgeCount);
    return purgeCount != 0;
}
Also used : IPortletDefinitionId(org.apereo.portal.portlet.om.IPortletDefinitionId) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) HttpSession(javax.servlet.http.HttpSession) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 47 with IPortletEntity

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

the class CachedPasswordUserInfoService method isPasswordRequested.

/**
 * Determine whether the portlet has expects a password as one of the user attributes.
 *
 * @param request portlet request
 * @param plutoPortletWindow portlet window
 * @return <code>true</code> if a password is expected, <code>false</code> otherwise
 * @throws PortletContainerException if expeced attributes cannot be determined
 */
public boolean isPasswordRequested(PortletRequest request, PortletWindow plutoPortletWindow) throws PortletContainerException {
    // get the list of requested user attributes
    final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
    final PortletApplicationDefinition portletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinition.getPortletDefinitionId());
    // check to see if the password key is one of the requested user attributes
    List<? extends UserAttribute> requestedUserAttributes = portletApplicationDescriptor.getUserAttributes();
    for (final UserAttribute userAttributeDD : requestedUserAttributes) {
        final String attributeName = userAttributeDD.getName();
        if (attributeName.equals(this.passwordKey))
            return true;
    }
    // if the password key wasn't found in the list of requested attributes
    return false;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) PortletApplicationDefinition(org.apache.pluto.container.om.portlet.PortletApplicationDefinition) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) UserAttribute(org.apache.pluto.container.om.portlet.UserAttribute) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 48 with IPortletEntity

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

the class PersonDirectoryUserInfoService method getExpectedUserAttributes.

/**
 * Get the list of user attributes the portlet expects
 *
 * @param request The current request.
 * @param portletWindow The window to get the expected user attributes for.
 * @return The List of expected user attributes for the portlet
 * @throws PortletContainerException If expected attributes cannot be determined
 */
protected List<? extends UserAttribute> getExpectedUserAttributes(HttpServletRequest request, final IPortletWindow portletWindow) throws PortletContainerException {
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
    final PortletApplicationDefinition portletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinition.getPortletDefinitionId());
    return portletApplicationDescriptor.getUserAttributes();
}
Also used : PortletApplicationDefinition(org.apache.pluto.container.om.portlet.PortletApplicationDefinition) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 49 with IPortletEntity

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

the class PortletEnvironmentServiceImpl method createPortletSession.

@Override
public PortletSession createPortletSession(PortletContext portletContext, PortletWindow portletWindow, HttpSession session) {
    // TODO pluto 1.1 PortletEnvironmentService#createPortletSession passed in the request; now
    // use IPortalRequestUtils#getCurrentPortalRequest()?
    final HttpServletRequest request = portalRequestUtils.getCurrentPortalRequest();
    final IPortletWindow internalPortletWindow = this.portletWindowRegistry.convertPortletWindow(request, portletWindow);
    final IPortletEntity portletEntity = internalPortletWindow.getPortletEntity();
    final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
    return new ScopingPortletSessionImpl(portletEntityId, portletContext, portletWindow, session);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) ScopingPortletSessionImpl(org.apereo.portal.portlet.session.ScopingPortletSessionImpl) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletEntityId(org.apereo.portal.portlet.om.IPortletEntityId)

Example 50 with IPortletEntity

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

the class RequestAttributeServiceImpl method getExpectedUserAttributes.

/**
 * Get the list of user attributes the portlet expects.
 *
 * @param request The current request.
 * @param portletWindow The window to get the expected user attributes for.
 * @return The List of expected user attributes for the portlet
 */
protected List<? extends UserAttribute> getExpectedUserAttributes(HttpServletRequest request, final IPortletWindow portletWindow) {
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
    final PortletApplicationDefinition portletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinition.getPortletDefinitionId());
    return portletApplicationDescriptor.getUserAttributes();
}
Also used : PortletApplicationDefinition(org.apache.pluto.container.om.portlet.PortletApplicationDefinition) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Aggregations

IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)63 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)32 IPortletEntityId (org.apereo.portal.portlet.om.IPortletEntityId)25 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)24 IPortletDefinitionId (org.apereo.portal.portlet.om.IPortletDefinitionId)19 IUserInstance (org.apereo.portal.user.IUserInstance)12 Test (org.junit.Test)11 IPortletPreference (org.apereo.portal.portlet.om.IPortletPreference)10 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)10 List (java.util.List)9 HttpServletRequest (javax.servlet.http.HttpServletRequest)9 PortletPreferenceImpl (org.apereo.portal.portlet.dao.jpa.PortletPreferenceImpl)9 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)9 BasePortalJpaDaoTest (org.apereo.portal.test.BasePortalJpaDaoTest)9 IPerson (org.apereo.portal.security.IPerson)7 PortletApplicationDefinition (org.apache.pluto.container.om.portlet.PortletApplicationDefinition)5 IUserPreferencesManager (org.apereo.portal.IUserPreferencesManager)5 IUserLayoutManager (org.apereo.portal.layout.IUserLayoutManager)5 ArrayList (java.util.ArrayList)4 Callable (java.util.concurrent.Callable)4