/**
* Get the portletApplicationId and portletName for the specified channel definition id. The portletApplicationId
* will be {@link Tuple#first} and the portletName will be {@link Tuple#second}
*/
public Tuple<String, String> getPortletDescriptorKeys(IPortletDefinition portletDefinition) {
final IChannelDefinition channelDefinition = portletDefinition.getChannelDefinition();
final String portletApplicationId;
final IChannelParameter isFrameworkPortletParam = channelDefinition.getParameter(IPortletAdaptor.CHANNEL_PARAM__IS_FRAMEWORK_PORTLET);
if (isFrameworkPortletParam != null && Boolean.valueOf(isFrameworkPortletParam.getValue())) {
portletApplicationId = this.servletContext.getContextPath();
}
else {
final IChannelParameter portletApplicaitonIdParam = channelDefinition.getParameter(IPortletAdaptor.CHANNEL_PARAM__PORTLET_APPLICATION_ID);
if (portletApplicaitonIdParam == null) {
throw new DataRetrievalFailureException("The specified ChannelDefinition does not provide the needed channel parameter '" + IPortletAdaptor.CHANNEL_PARAM__PORTLET_APPLICATION_ID + "'. ChannelDefinition=" + channelDefinition);
}
portletApplicationId = portletApplicaitonIdParam.getValue();
}
final IChannelParameter portletNameParam = channelDefinition.getParameter(IPortletAdaptor.CHANNEL_PARAM__PORTLET_NAME);
if (portletNameParam == null) {
throw new DataRetrievalFailureException("The specified ChannelDefinition does not provide the needed channel parameter '" + IPortletAdaptor.CHANNEL_PARAM__PORTLET_NAME + "'. ChannelDefinition=" + channelDefinition);
}
final String portletName = portletNameParam.getValue();