NodeList portletNodes = document.getElementsByTagName("channel");
for (int i = 0; i < portletNodes.getLength(); i++) {
try {
LayoutPortlet portlet = new LayoutPortlet();
NamedNodeMap attributes = portletNodes.item(i).getAttributes();
portlet.setTitle(attributes.getNamedItem("title").getNodeValue());
portlet.setDescription(attributes.getNamedItem("description").getNodeValue());
portlet.setNodeId(attributes.getNamedItem("ID").getNodeValue());
IPortletDefinition def = portletDao.getPortletDefinitionByFname(attributes.getNamedItem("fname").getNodeValue());
IPortletDefinitionParameter iconParam = def.getParameter("iconUrl");
if (iconParam != null) {
portlet.setIconUrl(iconParam.getValue());
}
// get the maximized URL for this portlet
final IPortalUrlBuilder portalUrlBuilder = urlProvider.getPortalUrlBuilderByLayoutNode(request, attributes.getNamedItem("ID").getNodeValue(), UrlType.RENDER);
final IPortletWindowId targetPortletWindowId = portalUrlBuilder.getTargetPortletWindowId();
if (targetPortletWindowId != null) {
final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(targetPortletWindowId);
portletUrlBuilder.setWindowState(WindowState.MAXIMIZED);
}
portlet.setUrl(portalUrlBuilder.getUrlString());
portlets.add(portlet);
} catch (Exception e) {
log.warn("Exception construction JSON representation of mobile portlet", e);
}