@Override public String toString() { return "PortletWindow [" + "portletWindowId=" + this.portletWindowData.getPortletWindowId() + ", " + "delegationParentId=" + this.portletWindowData.getDelegationParentId() + ", " + "portletMode=" + this.portletWindowData.getPortletMode() + ", " + "windowState=" + this.portletWindowData.getWindowState() + ", " + "expirationCache=" + this.portletWindowData.getExpirationCache() + ", " + "renderParameters=" + this.portletWindowData.getRenderParameters() + ", " + "publicRenderParameters=" + this.portletWindowData.getPublicRenderParameters() + ", " + "portletEntity=" + this.portletEntity + "]"; } }
@Override public void setExpirationCache(Integer expirationCache) { this.expirationCache = expirationCache; this.portletWindowData.setExpirationCache(expirationCache); }
new PortletWindowData(statelessPortletWindowId, portletEntityId); statelessPortletWindowDataMap.storeWindow(portletWindowData); new PortletWindowData(statelessPortletWindowId, portletEntityId); portletWindowData.setExpirationCache(basePortletWindow.getExpirationCache()); portletWindowData.setPortletMode(basePortletWindow.getPortletMode()); portletWindowData.setWindowState(basePortletWindow.getWindowState()); portletWindowData.setPublicRenderParameters( basePortletWindow.getPublicRenderParameters()); portletWindowData.setRenderParameters(basePortletWindow.getRenderParameters());
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.portletEntity == null) ? 0 : this.portletEntity.hashCode()); result = prime * result + ((this.portletWindowData.getPortletWindowId() == null) ? 0 : this.portletWindowData.getPortletWindowId().hashCode()); result = prime * result + ((this.portletWindowData.getDelegationParentId() == null) ? 0 : this.portletWindowData.getDelegationParentId().hashCode()); return result; }
@Override public PortletWindowID getId() { return this.portletWindowData.getPortletWindowId(); }
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); } }
/** * Initializes a newly created {@link PortletWindow}, the default implementation sets up the * appropriate {@link WindowState} and {@link javax.portlet.PortletMode} */ protected void initializePortletWindowData( HttpServletRequest request, PortletWindowData portletWindowData) { final IStylesheetDescriptor stylesheetDescriptor = getThemeStylesheetDescriptor(request); final IPortletEntityId portletEntityId = portletWindowData.getPortletEntityId(); final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, portletEntityId); final WindowState entityWindowState = portletEntity.getWindowState(stylesheetDescriptor); if (persistentWindowStates.contains(entityWindowState)) { portletWindowData.setWindowState(entityWindowState); } else if (entityWindowState != null) { // Set of persistent window states must have changed, nuke the old value this.logger.warn( "PortletEntity.windowState=" + entityWindowState + " but that state is not in the set of persistent WindowStates. PortletEntity.windowState will be set to null"); portletEntity.setWindowState(stylesheetDescriptor, null); this.portletEntityRegistry.storePortletEntity(request, portletEntity); } }
protected PortletWindowData getOrCreateDefaultPortletWindowData( HttpServletRequest request, IPortletEntityId portletEntityId, IPortletWindowId portletWindowId, IPortletWindowId delegationParentId) { // Sync on session map to make sure duplicate PortletWindowData is never created final PortletWindowCache<PortletWindowData> portletWindowDataMap = getPortletWindowDataMap(request); // Check if there portlet window data cached in the session PortletWindowData portletWindowData = portletWindowDataMap.getWindow(portletWindowId); if (portletWindowData != null) { logger.trace( "Found PortletWindowData {} in session cache", portletWindowData.getPortletWindowId()); return portletWindowData; } // Create new window data for and initialize portletWindowData = new PortletWindowData(portletWindowId, portletEntityId, delegationParentId); this.initializePortletWindowData(request, portletWindowData); // Store in the session cache portletWindowData = portletWindowDataMap.storeIfAbsentWindow(portletWindowData); logger.trace( "Created PortletWindowData {} and stored session cache, wrapping as IPortletWindow and returning", portletWindowData.getPortletWindowId()); return portletWindowData; }
@Override public Map<String, String[]> getRenderParameters() { if (this.renderParameters != null) { return this.renderParameters; } return this.portletWindowData.getRenderParameters(); }
@Override public PortletMode getPortletMode() { if (this.portletMode != null) { return this.portletMode; } return this.portletWindowData.getPortletMode(); }
@Override public WindowState getWindowState() { if (this.windowState != null) { return this.windowState; } return this.portletWindowData.getWindowState(); }
@Override public Map<String, String[]> getPublicRenderParameters() { if (this.publicRenderParameters != null) { return this.publicRenderParameters; } return this.portletWindowData.getPublicRenderParameters(); }
@Override public Integer getExpirationCache() { if (this.expirationCache != null) { return this.expirationCache; } return this.portletWindowData.getExpirationCache(); }
@Override public IPortletWindowId getDelegationParentId() { return this.portletWindowData.getDelegationParentId(); }
protected IPortletWindow wrapPortletWindowData( HttpServletRequest request, PortletWindowData portletWindowData) { final IPortletEntityId portletEntityId = portletWindowData.getPortletEntityId(); final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, portletEntityId); if (portletEntity == null) { return null; } final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor( portletDefinition.getPortletDefinitionId()); if (portletDescriptor == null) { return null; } final IPortletWindow portletWindow = new PortletWindowImpl(portletDescriptor, portletEntity, portletWindowData); logger.trace( "Wrapping PortletWindowData {} as IPortletWindow", portletWindow.getPortletWindowId()); return portletWindow; }
new PortletWindowData(statelessPortletWindowId, portletEntityId); statelessPortletWindowDataMap.storeWindow(portletWindowData); new PortletWindowData(statelessPortletWindowId, portletEntityId); portletWindowData.setExpirationCache(basePortletWindow.getExpirationCache()); portletWindowData.setPortletMode(basePortletWindow.getPortletMode()); portletWindowData.setWindowState(basePortletWindow.getWindowState()); portletWindowData.setPublicRenderParameters( basePortletWindow.getPublicRenderParameters()); portletWindowData.setRenderParameters(basePortletWindow.getRenderParameters());
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.portletEntity == null) ? 0 : this.portletEntity.hashCode()); result = prime * result + ((this.portletWindowData.getPortletWindowId() == null) ? 0 : this.portletWindowData.getPortletWindowId().hashCode()); result = prime * result + ((this.portletWindowData.getDelegationParentId() == null) ? 0 : this.portletWindowData.getDelegationParentId().hashCode()); return result; }
@Override public IPortletWindowId getPortletWindowId() { return this.portletWindowData.getPortletWindowId(); }
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); } }
/** * Initializes a newly created {@link PortletWindow}, the default implementation sets up the * appropriate {@link WindowState} and {@link javax.portlet.PortletMode} */ protected void initializePortletWindowData( HttpServletRequest request, PortletWindowData portletWindowData) { final IStylesheetDescriptor stylesheetDescriptor = getThemeStylesheetDescriptor(request); final IPortletEntityId portletEntityId = portletWindowData.getPortletEntityId(); final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, portletEntityId); final WindowState entityWindowState = portletEntity.getWindowState(stylesheetDescriptor); if (persistentWindowStates.contains(entityWindowState)) { portletWindowData.setWindowState(entityWindowState); } else if (entityWindowState != null) { // Set of persistent window states must have changed, nuke the old value this.logger.warn( "PortletEntity.windowState=" + entityWindowState + " but that state is not in the set of persistent WindowStates. PortletEntity.windowState will be set to null"); portletEntity.setWindowState(stylesheetDescriptor, null); this.portletEntityRegistry.storePortletEntity(request, portletEntity); } }