private boolean isFolder(IUserLayoutManager ulm, String id) { return ulm.getNode(id).getType().equals(IUserLayoutNodeDescription.LayoutNodeType.FOLDER); } }
+ name + "on object of type: " + node.getType());
private String getTabIdFromName(IUserLayout userLayout, String tabName) { @SuppressWarnings("unchecked") Enumeration<String> childrenOfRoot = userLayout.getChildIds(userLayout.getRootId()); while (childrenOfRoot .hasMoreElements()) { // loop over folders that might be the favorites folder String nodeId = childrenOfRoot.nextElement(); try { IUserLayoutNodeDescription nodeDescription = userLayout.getNodeDescription(nodeId); IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType(); if (IUserLayoutNodeDescription.LayoutNodeType.FOLDER.equals(nodeType) && nodeDescription instanceof IUserLayoutFolderDescription) { IUserLayoutFolderDescription folderDescription = (IUserLayoutFolderDescription) nodeDescription; if (tabName.equalsIgnoreCase(folderDescription.getName())) { return folderDescription.getId(); } } } catch (Exception e) { logger.error("Error getting the nodeID of the tab name " + tabName, e); } } logger.warn("Tab " + tabName + " was searched for but not found"); return null; // didn't find tab }
if (FOLDER.equals(nodeDescription.getType()) && nodeDescription instanceof IUserLayoutFolderDescription) {
public String getFavoriteTabNodeId(IUserLayout userLayout) { @SuppressWarnings("unchecked") Enumeration<String> childrenOfRoot = userLayout.getChildIds(userLayout.getRootId()); while (childrenOfRoot .hasMoreElements()) { // loop over folders that might be the favorites folder String nodeId = childrenOfRoot.nextElement(); try { IUserLayoutNodeDescription nodeDescription = userLayout.getNodeDescription(nodeId); IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType(); if (FOLDER.equals(nodeType) && nodeDescription instanceof IUserLayoutFolderDescription) { IUserLayoutFolderDescription folderDescription = (IUserLayoutFolderDescription) nodeDescription; if (FAVORITES_TYPE.equalsIgnoreCase(folderDescription.getFolderType())) { return folderDescription.getId(); } } } catch (Exception e) { logger.error( "Ignoring on error a node while examining for favorites: node ID is [{}]", nodeId, e); } } logger.warn("Favorite tab was searched for but not found"); return null; // didn't find favorite tab }
IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType();
/** * Verify the requested node exists in the user's layout. Also if the node exists see if it is a * portlet node and if it is return the {@link IPortletWindowId} of the corresponding portlet. */ protected LayoutNodeType getLayoutNodeType(HttpServletRequest request, String folderNodeId) { final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); final IUserLayoutNodeDescription node = userLayoutManager.getNode(folderNodeId); if (node == null) { return null; } return node.getType(); } }
if (!PortletEntityIdStringUtils.isDelegateLayoutNode(layoutNodeId)) { final IUserLayoutNodeDescription node = userLayoutManager.getNode(layoutNodeId); if (node == null || node.getType() != LayoutNodeType.PORTLET) { throw new IllegalArgumentException( "No portlet layout node found for "
if (!PortletEntityIdStringUtils.isDelegateLayoutNode(layoutNodeId)) { final IUserLayoutNodeDescription node = userLayoutManager.getNode(layoutNodeId); if (node == null || node.getType() != LayoutNodeType.PORTLET) { throw new IllegalArgumentException( "No portlet layout node found for "