use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletWindowRegistryImpl method getOrCreateDefaultPortletWindowByFname.
@Override
public IPortletWindow getOrCreateDefaultPortletWindowByFname(HttpServletRequest request, String fname) {
Validate.notNull(request, "HttpServletRequest cannot be null");
Validate.notNull(fname, "fname cannot be null");
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreatePortletEntityByFname(request, userInstance, fname);
if (portletEntity == null) {
return null;
}
final IPortletWindow portletWindow = this.getOrCreateDefaultPortletWindow(request, portletEntity.getPortletEntityId());
logger.trace("Found portlet window {} for portlet definition fname {}", portletWindow, fname);
return portletWindow;
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletWindowRegistryImpl method getOrCreateDefaultPortletWindow.
@Override
public IPortletWindow getOrCreateDefaultPortletWindow(HttpServletRequest request, IPortletEntityId portletEntityId) {
Validate.notNull(request, "request can not be null");
Validate.notNull(portletEntityId, "portletEntityId can not be null");
final IPortletWindowId portletWindowId = this.getDefaultPortletWindowId(request, portletEntityId);
final PortletWindowCache<IPortletWindow> portletWindowMap = getPortletWindowMap(request);
//Check if there is portlet window cached in the request
IPortletWindow portletWindow = portletWindowMap.getWindow(portletWindowId);
if (portletWindow != null) {
logger.trace("Found IPortletWindow {} in request cache", portletWindow.getPortletWindowId());
return portletWindow;
}
final PortletWindowData portletWindowData = this.getOrCreateDefaultPortletWindowData(request, portletEntityId, portletWindowId);
portletWindow = wrapPortletWindowData(request, portletWindowData);
if (portletWindow == null) {
return null;
}
//Cache the wrapped window in the request
return portletWindowMap.storeIfAbsentWindow(portletWindow);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletDefinitionAttributeSource method getCacheKey.
@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.name);
// We need something that makes for a unique cache key. For lack of anything else useful,
// use the set of all layout portlet window ids in the user's layout.
final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllLayoutPortletWindows(request);
for (final IPortletWindow portletWindow : portletWindows) {
if (portletWindow != null) {
final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
cacheKeyBuilder.add(portletWindowId);
} else {
this.logger.warn("portletWindowRegistry#getAllLayoutPortletWindows() returned a null portletWindow");
}
}
return cacheKeyBuilder.build();
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletPlaceholderEventSource method generateCharacterEvents.
@Override
public void generateCharacterEvents(HttpServletRequest servletRequest, MatchResult matchResult, Collection<CharacterEvent> eventBuffer) {
final String subscribeId = matchResult.group(this.portletIdGroup);
if (subscribeId == null) {
this.logger.warn("MatchResult returned null for group " + this.portletIdGroup + ". No PortletPlaceholderEvent will be generated. " + matchResult);
return;
}
final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByLayoutNodeId(servletRequest, subscribeId);
final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
this.generateCharacterEvents(portletWindowId, matchResult, eventBuffer);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletUtils method getStringFromPortletUrl.
/**
* A static EL function that is defined in portletUrl.tld Takes a portletUrl object and coverts
* it into an actual Url Example is in search, returns a marketplace entry Url
*
* @param portletUrl
* @param request
* @return the Url represented by portletUrl
*/
public static String getStringFromPortletUrl(PortletUrl portletUrl, HttpServletRequest request) {
if (portletUrl == null) {
return null;
}
//Default urlType
UrlType urlType = UrlType.RENDER;
final PortletUrlType type = portletUrl.getType();
switch(type) {
case ACTION:
urlType = UrlType.ACTION;
break;
case RESOURCE:
urlType = UrlType.RESOURCE;
break;
default:
urlType = UrlType.RENDER;
break;
}
IPortletWindow marketplaceWindow = portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(request, MarketplacePortletDefinition.MARKETPLACE_FNAME);
IPortalUrlBuilder portalUrlBuilder = portalUrlProvider.getPortalUrlBuilderByPortletWindow(request, marketplaceWindow.getPortletWindowId(), urlType);
IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getTargetedPortletUrlBuilder();
final String portletMode = portletUrl.getPortletMode();
if (portletMode != null) {
portletUrlBuilder.setPortletMode(PortletUtils.getPortletMode(portletMode));
}
final String windowState = portletUrl.getWindowState();
if (windowState != null) {
portletUrlBuilder.setWindowState(PortletUtils.getWindowState(windowState));
}
for (final PortletUrlParameter param : portletUrl.getParam()) {
final String name = param.getName();
final List<String> values = param.getValue();
portletUrlBuilder.addParameter(name, values.toArray(new String[values.size()]));
}
return portalUrlBuilder.getUrlString();
}
Aggregations