@Override public boolean canUpdateNode(IUserLayoutNodeDescription node) throws PortalException { // allow all updates, except for those related to the transient channels and folders String nodeId = node.getId(); if (nodeId != null && (!mSubIdMap.containsKey(nodeId)) && (!nodeId.equals(TRANSIENT_FOLDER_ID))) { return man.canUpdateNode(node); } else { return false; } }
@Override public boolean updateNode(IUserLayoutNodeDescription node) throws PortalException { // allow all updates, except for those related to the transient channels and folders String nodeId = node.getId(); if (nodeId != null && (!mSubIdMap.containsKey(nodeId)) && (!nodeId.equals(TRANSIENT_FOLDER_ID))) { return man.updateNode(node); } else { return false; } }
private boolean canMoveRight(String nodeId, String targetNextSibId) throws PortalException { IUserLayoutNodeDescription node = getNode(nodeId); Enumeration sibIds = getVisibleChildIds(getParentId(nodeId)); List sibs = Collections.list(sibIds); for (int idx = sibs.indexOf(nodeId) + 1; idx > 0 && idx < sibs.size(); idx++) { String nextSibId = (String) sibs.get(idx); IUserLayoutNodeDescription next = getNode(nextSibId); if (nextSibId != null && next.getId().equals(targetNextSibId)) return true; else if (!isFragmentOwner && !MovementRules.canHopRight(node, next)) return false; } if (targetNextSibId == null) // made it to end of sib list and return true; // that is the desired location return false; // oops never found the sib. Should never happen. }
private boolean canMoveLeft(String nodeId, String targetNextSibId) throws PortalException { IUserLayoutNodeDescription node = getNode(nodeId); Enumeration sibIds = getVisibleChildIds(getParentId(nodeId)); List sibs = Collections.list(sibIds); for (int idx = sibs.indexOf(nodeId) - 1; idx >= 0; idx--) { String prevSibId = (String) sibs.get(idx); IUserLayoutNodeDescription prev = getNode(prevSibId); if (!isFragmentOwner && !MovementRules.canHopLeft(node, prev)) return false; if (targetNextSibId != null && prev.getId().equals(targetNextSibId)) return true; } return false; // oops never found the sib }
if (!getParentId(node.getId()).equals(parent.getId())) return (isFragmentOwner || node.isMoveAllowed()) && canAddNode(node, parent, nextSiblingId); Element parentE = uld.getElementById(parent.getId()); Element child = (Element) parentE.getFirstChild(); int idx = 0; if (id.equals(node.getId())) nodeIdx = idx; if (id.equals(nextSiblingId)) sibIdx = idx; idx++; return canMoveRight(node.getId(), nextSiblingId); return canMoveLeft(node.getId(), nextSiblingId);
request, PreferencesScope.STRUCTURE, node.getId(), name, structureAttributes.get(name));
String nodeId = node.getId();
String nodeId = node.getId();
+ "."); if (!parent.getId().equals(getParentId(nextSiblingId))) { throw new PortalException( "Given sibling (\"" + nextSiblingId + "\") is not a child of a given parentId (\"" + parent.getId() + "\"). Occurred " + "in layout for " Enumeration sibIds = getVisibleChildIds(parent.getId()); List sibs = Collections.list(sibIds); if (prev.getId().equals(nextSiblingId)) return true;
String nodeId = node.getId();
"Added " + channelTitle + " as a favorite.", locale)); model.put("newNodeId", node.getId()); return new ModelAndView("jsonView", model); } else {
private IUserLayoutNodeDescription addNodeToTab( IUserLayoutManager ulm, IUserLayoutChannelDescription channel, String tabId) { IUserLayoutNodeDescription node = null; Enumeration<String> columns = ulm.getChildIds(tabId); if (columns.hasMoreElements()) { while (columns.hasMoreElements()) { // attempt to add this channel to the column node = ulm.addNode(channel, columns.nextElement(), null); // if it couldn't be added to this column, go on and try the next // one. otherwise, we're set. if (node != null) break; } } else { IUserLayoutFolderDescription newColumn = new UserLayoutFolderDescription(); newColumn.setName("Column"); newColumn.setId("tbd"); newColumn.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); newColumn.setHidden(false); newColumn.setUnremovable(false); newColumn.setImmutable(false); // add the column to our layout IUserLayoutNodeDescription col = ulm.addNode(newColumn, tabId, null); // add the channel node = ulm.addNode(channel, col.getId(), null); } return node; }
final String fname = ((IUserLayoutChannelDescription) node).getFunctionalName(); this.portalEventFactory.publishPortletMovedInLayoutPortalEvent( this, this.owner, layoutId, oldParentNodeId, parent.getId(), fname); } else { this.portalEventFactory.publishFolderMovedInLayoutPortalEvent( this, this.owner, layoutId, oldParentNodeId, parent.getId());
childElement.setAttribute(Constants.ATT_ID, node.getId()); this.updateCacheKey(); final String fname = ((IUserLayoutChannelDescription) node).getFunctionalName(); this.portalEventFactory.publishPortletAddedToLayoutPortalEvent( this, this.owner, layoutId, parent.getId(), fname); } else { this.portalEventFactory.publishFolderAddedToLayoutPortalEvent( this, this.owner, layoutId, node.getId());
/** * Verify the requested portlet window corresponds to a node in the user's layout and return the * corresponding layout node id */ protected String verifyPortletWindowId( HttpServletRequest request, IPortletWindowId portletWindowId) { final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request); final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager(); final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager(); final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId); final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId(); if (delegationParentWindowId != null) { return verifyPortletWindowId(request, delegationParentWindowId); } final IPortletEntity portletEntity = portletWindow.getPortletEntity(); final String channelSubscribeId = portletEntity.getLayoutNodeId(); final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId); if (node == null) { throw new IllegalArgumentException( "No layout node exists for id " + channelSubscribeId + " of window " + portletWindowId); } return node.getId(); }
success = attemptNodeMove(ulm, sourceId, col.getId(), null); } else { logger.info(
public synchronized boolean updateNode(IUserLayoutNodeDescription node) throws PortalException { if (canUpdateNode(node)) { String nodeId = node.getId(); IUserLayoutNodeDescription oldNode = getNode(nodeId);
layoutId, parentNodeId, nodeDescription.getId(), nodeDescription.getName());