@Override public String toString() { return "PortletEntity [" + "portletEntityId=" + this.standardEntityId + ", " + "layoutNodeId=" + this.persistentEntity.getLayoutNodeId() + ", " + "userId=" + this.persistentEntity.getUserId() + ", " + "portletDefinition=" + this.persistentEntity.getPortletDefinition() + "]"; } }
@Override public IPortletDefinitionId getPortletDefinitionId() { return this.persistentEntity.getPortletDefinitionId(); }
@Override public String toString() { return "PortletEntity [" + "portletEntityId=" + this.delegatePortletEntity.getPortletEntityId() + ", " + "layoutNodeId=" + this.transientLayoutNodeId + ", " + "userId=" + this.delegatePortletEntity.getUserId() + ", " + "portletDefinition=" + this.delegatePortletEntity.getPortletDefinition() + "]"; } }
@Override public boolean shouldBePersisted(IPortletEntity portletEntity) { // Delegate entities should NEVER be persisted final String layoutNodeId = portletEntity.getLayoutNodeId(); if (PortletEntityIdStringUtils.isDelegateLayoutNode(layoutNodeId)) { return false; } // Only non delegate entities with preferences or a non-null window state should be // persisted final List<IPortletPreference> preferences = portletEntity.getPortletPreferences(); return !CollectionUtils.isEmpty(preferences) || !portletEntity.getWindowStates().isEmpty(); }
@Override public IPortletDefinition getPortletDefinition() { return this.persistentEntity.getPortletDefinition(); }
@RequestCache(keyMask = {false, true}) @Override public String getFolderNameForPortlet( HttpServletRequest request, IPortletWindowId portletWindowId) { final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId); final IPortletEntity portletEntity = portletWindow.getPortletEntity(); final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); final String fname = portletDefinition.getFName(); final String layoutNodeId = portletEntity.getLayoutNodeId(); // Build the targeted portlet string (fname + subscribeId) return fname + PORTLET_PATH_ELEMENT_SEPERATOR + layoutNodeId; }
protected IPortletEntity createPersistentEntity( final IPortletEntity portletEntity, final IPortletEntityId wrapperPortletEntityId) { final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId(); final String layoutNodeId = portletEntity.getLayoutNodeId(); final int userId = portletEntity.getUserId(); final List<IPortletPreference> existingPreferences = portletEntity.getPortletPreferences(); final List<IPortletPreference> persistentPreferences = persistentEntity.getPortletPreferences(); final Map<Long, WindowState> windowStates = portletEntity.getWindowStates(); for (Map.Entry<Long, WindowState> windowStateEntry : windowStates.entrySet()) { final Long stylesheetDescriptorId = windowStateEntry.getKey(); stylesheetDescriptorDao.getStylesheetDescriptor(stylesheetDescriptorId); final WindowState windowState = windowStateEntry.getValue(); persistentEntity.setWindowState(stylesheetDescriptor, windowState);
final IPortletEntityId wrapperPortletEntityId = portletEntity.getPortletEntityId(); final Lock portletEntityLock = this.getPortletEntityLock(request, wrapperPortletEntityId); portletEntityLock.lock(); persistentEntity.getPortletEntityId()); if (!exists) { this.logger.warn( portletEntity.getPortletDefinitionId(); final String layoutNodeId = portletEntity.getLayoutNodeId(); final int userId = portletEntity.getUserId(); + wrapperPortletEntityId + " should now be persistent. Deleted it from session cache and created persistent portlet entity " + persistentEntity.getPortletEntityId()); final String channelSubscribeId = portletEntity.getLayoutNodeId(); final int userId = portletEntity.getUserId(); IPortletEntity existingPersistentEntity = this.portletEntityDao.getPortletEntity(channelSubscribeId, userId);
portletEntity.getPortletDefinitionId(); final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor( final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId(); this.portletEntityRegistry.getOrCreateDefaultPortletEntity( request, portletDefinitionId); if (defaultPortletEntity.equals(portletEntity)) { portletDefinitions.remove(portletDefinition); final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId(); final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllPortletWindowsForEntity( request, portletDefinitionId); final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId(); final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllPortletWindowsForEntity(
@Override protected void loadBasePortletPreferences( IPortletEntity portletEntity, Map<String, IPortletPreference> basePortletPreferences) { final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); // Add descriptor prefs to base Map final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId(); final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId); final Preferences descriptorPreferences = portletDescriptor.getPortletPreferences(); for (final Preference preference : descriptorPreferences.getPortletPreferences()) { final IPortletPreference preferenceWrapper = new PortletPreferenceImpl(preference); basePortletPreferences.put(preferenceWrapper.getName(), preferenceWrapper); } // Add definition prefs to base Map final List<IPortletPreference> definitionPreferences = portletDefinition.getPortletPreferences(); for (final IPortletPreference preference : definitionPreferences) { basePortletPreferences.put(preference.getName(), preference); } // Add entity prefs to base Map final List<IPortletPreference> entityPreferences = portletEntity.getPortletPreferences(); for (final IPortletPreference preference : entityPreferences) { basePortletPreferences.put(preference.getName(), preference); } }
@Override public IPortletEntityId getPortletEntityId() { return this.portletEntity.getPortletEntityId(); }
final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId(); final IPortletEntity existingPersistentEntity = this.portletEntityDao.getPortletEntity( persistentEntity.getLayoutNodeId(), persistentEntity.getUserId()); if (existingPersistentEntity != null) { this.portletEntityDao.deletePortletEntity(existingPersistentEntity);
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.transientLayoutNodeId == null) ? 0 : this.transientLayoutNodeId.hashCode()); result = prime * result + ((this.delegatePortletEntity.getPortletDefinition() == null) ? 0 : this.delegatePortletEntity.getPortletDefinition().hashCode()); result = prime * result + this.delegatePortletEntity.getUserId(); return result; }
@Override public String getLayoutNodeId() { return this.persistentEntity.getLayoutNodeId(); }
/** * 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); } }
final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId(); return new PortletDefinitionPreferencesImpl( portletDefinitionRegistry, transactionOperations, portletDefinitionId, render); } else if (this.isStoreInMemory(containerRequest)) { final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId(); return new GuestPortletEntityPreferencesImpl( requestContext, render); } else { final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId(); return new PortletEntityPreferencesImpl( requestContext,
entityItr.hasNext(); ) { final IPortletEntity portletEntity = entityItr.next(); final List<IPortletPreference> preferencesList = portletEntity.getPortletPreferences(); final String layoutNodeId = portletEntity.getLayoutNodeId(); final Pathref dlmPathref = nodeReferenceFactory.getPathrefFromNoderef(userName, layoutNodeId, layout);
portletEntity.getPortletPreferences(); portletEntity.setPortletPreferences(null);
@Override public List<IPortletPreference> getPortletPreferences() { return this.persistentEntity.getPortletPreferences(); }
@Override public boolean setPortletPreferences(List<IPortletPreference> portletPreferences) { return delegatePortletEntity.setPortletPreferences(portletPreferences); }