/** * @param request * @param portletEntityId * @param portletWindows * @param portletWindowMap * @param portletWindowDataMap */ protected void addPortletWindowData( HttpServletRequest request, IPortletEntityId portletEntityId, final Set<IPortletWindow> portletWindows, final PortletWindowCache<IPortletWindow> portletWindowMap, final PortletWindowCache<PortletWindowData> portletWindowDataMap) { final Set<PortletWindowData> windows = portletWindowDataMap.getWindows(portletEntityId); if (windows == null) { return; } for (final PortletWindowData portletWindowData : windows) { final IPortletWindowId portletWindowId = portletWindowData.getPortletWindowId(); // Skip data windows that aren't for this entity and for windows that are already in the // request cache if (!portletEntityId.equals(portletWindowData.getPortletEntityId()) || portletWindowMap.containsWindow(portletWindowId)) { continue; } // Wrap the data in a window and stick it in the request cache IPortletWindow portletWindow = this.wrapPortletWindowData(request, portletWindowData); portletWindow = portletWindowMap.storeIfAbsentWindow(portletWindow); portletWindows.add(portletWindow); } }
@Override public Set<IPortletWindow> getAllPortletWindowsForEntity( HttpServletRequest request, IPortletEntityId portletEntityId) { Validate.notNull(request, "request can not be null"); Validate.notNull(portletEntityId, "portletEntityId can not be null"); final PortletWindowCache<IPortletWindow> portletWindowMap = getPortletWindowMap(request); final Set<IPortletWindow> portletWindows = new LinkedHashSet<IPortletWindow>(portletWindowMap.getWindows(portletEntityId)); // Check for session cached windows that haven't been accessed in this request final PortletWindowCache<PortletWindowData> portletWindowDataMap = this.getPortletWindowDataMap(request); this.addPortletWindowData( request, portletEntityId, portletWindows, portletWindowMap, portletWindowDataMap); // Check for stateless windows that exist on this request final PortletWindowCache<PortletWindowData> statelessPortletWindowDataMap = this.getStatelessPortletWindowDataMap(request, false); if (statelessPortletWindowDataMap != null) { this.addPortletWindowData( request, portletEntityId, portletWindows, portletWindowMap, statelessPortletWindowDataMap); } // If there were no windows in the set create the default one for the entity if (portletWindows.isEmpty()) { final IPortletWindow portletWindow = this.getOrCreateDefaultPortletWindow(request, portletEntityId); portletWindows.add(portletWindow); } return portletWindows; }