@Override public IPortletEntity getOrCreatePortletEntityByFname( HttpServletRequest request, IUserInstance userInstance, String fname, String preferredChannelSubscribeId) { try { final IPortletEntity portletEntity = this.getOrCreatePortletEntity( request, userInstance, preferredChannelSubscribeId); if (portletEntity != null) { // Verify the fname matches before returning the entity final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); if (fname.equals(portletDefinition.getFName())) { return portletEntity; } } } catch (PortalException pe) { // Ignored, can be the case if no layout node exists for the specified subscribe ID } // Either the layout node didn't exist or the entity for the node doesn't match the // requested fname return this.getOrCreatePortletEntityByFname(request, userInstance, fname); }
@Override public IPortletEntity getOrCreatePortletEntityByFname( HttpServletRequest request, IUserInstance userInstance, String fname) { final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); final String subscribeId = userLayoutManager.getSubscribeId(fname); return this.getOrCreatePortletEntity(request, userInstance, subscribeId); }
@Override public IPortletEntity getOrCreatePortletEntityByFname( HttpServletRequest request, IUserInstance userInstance, String fname) { final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); final String subscribeId = userLayoutManager.getSubscribeId(fname); return this.getOrCreatePortletEntity(request, userInstance, subscribeId); }
@Override public IPortletEntity getOrCreatePortletEntityByFname( HttpServletRequest request, IUserInstance userInstance, String fname, String preferredChannelSubscribeId) { try { final IPortletEntity portletEntity = this.getOrCreatePortletEntity( request, userInstance, preferredChannelSubscribeId); if (portletEntity != null) { // Verify the fname matches before returning the entity final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); if (fname.equals(portletDefinition.getFName())) { return portletEntity; } } } catch (PortalException pe) { // Ignored, can be the case if no layout node exists for the specified subscribe ID } // Either the layout node didn't exist or the entity for the node doesn't match the // requested fname return this.getOrCreatePortletEntityByFname(request, userInstance, fname); }
@Override public IPortletEntity getOrCreateDelegatePortletEntity( HttpServletRequest request, IPortletWindowId parentPortletWindowId, IPortletDefinitionId delegatePortletDefinitionId) { // Create a special synthetic layout node ID for the delegate entity final String layoutNodeId = PortletWindowIdStringUtils.convertToDelegateLayoutNodeId( parentPortletWindowId.toString()); // Grab the current user final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IPerson person = userInstance.getPerson(); final int userId = person.getID(); // Use the general API, the only thing special is the layout node id return getOrCreatePortletEntity(request, delegatePortletDefinitionId, layoutNodeId, userId); }
@Override public IPortletEntity getOrCreateDelegatePortletEntity( HttpServletRequest request, IPortletWindowId parentPortletWindowId, IPortletDefinitionId delegatePortletDefinitionId) { // Create a special synthetic layout node ID for the delegate entity final String layoutNodeId = PortletWindowIdStringUtils.convertToDelegateLayoutNodeId( parentPortletWindowId.toString()); // Grab the current user final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IPerson person = userInstance.getPerson(); final int userId = person.getID(); // Use the general API, the only thing special is the layout node id return getOrCreatePortletEntity(request, delegatePortletDefinitionId, layoutNodeId, userId); }
@Override public IPortletEntity getOrCreateDefaultPortletEntity( HttpServletRequest request, IPortletDefinitionId portletDefinitionId) { Validate.notNull(request, "HttpServletRequest cannot be null"); Validate.notNull(portletDefinitionId, "portletDefinitionId cannot be null"); final IPortletDefinition portletDefinition = this.getPortletDefinition(request, portletDefinitionId); if (portletDefinition == null) { throw new IllegalArgumentException( "No portlet definition found for id '" + portletDefinitionId + "'."); } // Determine the appropriate portlet window ID for the definition final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); // Determine the subscribe ID final String portletFName = portletDefinition.getFName(); final String layoutNodeId = userLayoutManager.getSubscribeId(portletFName); if (layoutNodeId == null) { throw new IllegalArgumentException( "No layout node ID found for fname '" + portletFName + "'."); } this.logger.trace( "Found layout node {} for portlet definition {}", layoutNodeId, portletFName); final IPerson person = userInstance.getPerson(); final int personId = person.getID(); return this.getOrCreatePortletEntity(request, portletDefinitionId, layoutNodeId, personId); }
@Override public IPortletEntity getOrCreateDefaultPortletEntity( HttpServletRequest request, IPortletDefinitionId portletDefinitionId) { Validate.notNull(request, "HttpServletRequest cannot be null"); Validate.notNull(portletDefinitionId, "portletDefinitionId cannot be null"); final IPortletDefinition portletDefinition = this.getPortletDefinition(request, portletDefinitionId); if (portletDefinition == null) { throw new IllegalArgumentException( "No portlet definition found for id '" + portletDefinitionId + "'."); } // Determine the appropriate portlet window ID for the definition final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); // Determine the subscribe ID final String portletFName = portletDefinition.getFName(); final String layoutNodeId = userLayoutManager.getSubscribeId(portletFName); if (layoutNodeId == null) { throw new IllegalArgumentException( "No layout node ID found for fname '" + portletFName + "'."); } this.logger.trace( "Found layout node {} for portlet definition {}", layoutNodeId, portletFName); final IPerson person = userInstance.getPerson(); final int personId = person.getID(); return this.getOrCreatePortletEntity(request, portletDefinitionId, layoutNodeId, personId); }
@Override public IPortletEntity getOrCreatePortletEntity( HttpServletRequest request, IUserInstance userInstance, String layoutNodeId) { final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); // Find the channel and portlet definitions final IUserLayoutChannelDescription channelNode = (IUserLayoutChannelDescription) userLayoutManager.getNode(layoutNodeId); if (channelNode == null) { this.logger.warn( "No layout node exists for id " + layoutNodeId + ", no portlet entity will be returned."); return null; } final String channelPublishId = channelNode.getChannelPublishId(); final IPortletDefinition portletDefinition = this.getPortletDefinition(request, userInstance, channelPublishId); if (portletDefinition != null) { final IPerson person = userInstance.getPerson(); return this.getOrCreatePortletEntity( request, portletDefinition.getPortletDefinitionId(), layoutNodeId, person.getID()); } // No permission to see the portlet return null; }
@Override public IPortletEntity getOrCreatePortletEntity( HttpServletRequest request, IUserInstance userInstance, String layoutNodeId) { final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); // Find the channel and portlet definitions final IUserLayoutChannelDescription channelNode = (IUserLayoutChannelDescription) userLayoutManager.getNode(layoutNodeId); if (channelNode == null) { this.logger.warn( "No layout node exists for id " + layoutNodeId + ", no portlet entity will be returned."); return null; } final String channelPublishId = channelNode.getChannelPublishId(); final IPortletDefinition portletDefinition = this.getPortletDefinition(request, userInstance, channelPublishId); if (portletDefinition != null) { final IPerson person = userInstance.getPerson(); return this.getOrCreatePortletEntity( request, portletDefinition.getPortletDefinitionId(), layoutNodeId, person.getID()); } // No permission to see the portlet return null; }
this.getOrCreatePortletEntity( request, portletDefinitionId, layoutNodeId, userId);
this.getOrCreatePortletEntity( request, portletDefinitionId, layoutNodeId, userId);