protected IPortletEntity wrapEntity ( IPortletEntity portletEntity ) { if ( portletEntity == null ) { return null ; } final String persistentLayoutNodeId = portletEntity . getLayoutNodeId ( ) ; if ( persistentLayoutNodeId . startsWith ( TransientUserLayoutManagerWrapper . SUBSCRIBE_PREFIX ) ) { final IUserLayoutManager userLayoutManager = this . getUserLayoutManager ( ) ; if ( userLayoutManager == null ) { this . logger . warn ( "Could not find IUserLayoutManager when trying to wrap transient portlet entity: " + portletEntity ) ; return portletEntity ; } final IPortletDefinition portletDefinition = portletEntity . getPortletDefinition ( ) ; final String fname = portletDefinition . getFName ( ) ; final String layoutNodeId = userLayoutManager . getSubscribeId ( fname ) ; return new TransientPortletEntity ( portletEntity , layoutNodeId ) ; } return portletEntity ; }
Adds a TransientPortletEntity wrapper to the portletEntity if it is needed . If the specified entity is transient but no transient subscribe id has been registered for it yet in the transientIdMap null is returned . If no wrapping is needed the original entity is returned .