public static String convertToDelegateLayoutNodeId(final String portletWindowIdString) { final String portletEntityIdString = parsePortletEntityId(portletWindowIdString); final String portletWindowInstanceIdString = parsePortletWindowInstanceId(portletWindowIdString); final String converted = PortletEntityIdStringUtils.convertToDelegateLayoutNodeId(portletEntityIdString); return (portletWindowInstanceIdString == null) ? converted : converted + ID_PART_SEPARATOR + portletWindowInstanceIdString; }
@Override public PortletWindowIdImpl getPortletWindowId( HttpServletRequest request, String portletWindowId) { Validate.notNull(portletWindowId, "portletWindowId can not be null"); final String entityIdStr = PortletWindowIdStringUtils.parsePortletEntityId(portletWindowId); final String instanceId; if (!PortletEntityIdStringUtils.hasCorrectNumberOfParts(entityIdStr) || !PortletWindowIdStringUtils.hasCorrectNumberOfParts(portletWindowId)) { throw new IllegalArgumentException( "Provided portlet window ID '" + portletWindowId + "' is not valid"); } if (PortletWindowIdStringUtils.hasPortletWindowInstanceId(portletWindowId)) { instanceId = PortletWindowIdStringUtils.parsePortletWindowInstanceId(portletWindowId); } else { instanceId = null; } final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, entityIdStr); if (portletEntity == null) { throw new IllegalArgumentException( "No parent IPortletEntity found for id '" + entityIdStr + "' from portlet window id: " + portletWindowId); } return createPortletWindowId(instanceId, portletEntity.getPortletEntityId()); }
@Override public PortletWindowIdImpl getPortletWindowId( HttpServletRequest request, String portletWindowId) { Validate.notNull(portletWindowId, "portletWindowId can not be null"); final String entityIdStr = PortletWindowIdStringUtils.parsePortletEntityId(portletWindowId); final String instanceId; if (!PortletEntityIdStringUtils.hasCorrectNumberOfParts(entityIdStr) || !PortletWindowIdStringUtils.hasCorrectNumberOfParts(portletWindowId)) { throw new IllegalArgumentException( "Provided portlet window ID '" + portletWindowId + "' is not valid"); } if (PortletWindowIdStringUtils.hasPortletWindowInstanceId(portletWindowId)) { instanceId = PortletWindowIdStringUtils.parsePortletWindowInstanceId(portletWindowId); } else { instanceId = null; } final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, entityIdStr); if (portletEntity == null) { throw new IllegalArgumentException( "No parent IPortletEntity found for id '" + entityIdStr + "' from portlet window id: " + portletWindowId); } return createPortletWindowId(instanceId, portletEntity.getPortletEntityId()); }
@Test public void parsePortletEntityIdTest() { String portletEntityId = PortletWindowIdStringUtils.parsePortletEntityId("71_u54_12.2"); assertNotNull(portletEntityId); assertEquals(portletEntityId, "71_u54_12"); }