@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; } }
private boolean isFolder(IUserLayoutManager ulm, String id) { return ulm.getNode(id).getType().equals(IUserLayoutNodeDescription.LayoutNodeType.FOLDER); } }
/** * Returns true if the node exists in the underlying DOM model and it does not contain a * 'deleteAllowed' attribute with a value of 'false'. */ protected boolean canDeleteNode(IUserLayoutNodeDescription node) throws PortalException { if (node == null) return false; // todo if isFragmentOwner should probably verify node is part of the // same layout fragment as the fragment owner to insure a misbehaving front-end doesn't // do an improper operation. return isFragmentOwner || node.isDeleteAllowed(); }
boolean nbhMoveAld = nbh.isMoveAllowed(); boolean hopperMoveAld = hopper.isMoveAllowed(); double Pnbh = nbh.getPrecedence(); double Ph = hopper.getPrecedence();
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);
if (node instanceof IUserLayoutChannelDescription) { isChannel = true; node.setId(this.distributedLayoutStore.generateNewChannelSubscribeId(owner)); } else { node.setId(this.distributedLayoutStore.generateNewFolderId(owner)); Element childElement = node.getXML(uld); Element parentElement = uld.getElementById(parentId); if (nextSiblingId == null) { 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());
String userFacingNodeName = nodeDescription.getName(); response.setRenderParameter("nameOfFavoriteActedUpon", userFacingNodeName); if (nodeDescription.isDeleteAllowed()) {
/** * Returns true if we are dealing with a fragment layout or if editing of attributes is allowed, * or the node is a channel since ad-hoc parameters can always be added. */ @Override public boolean canUpdateNode(IUserLayoutNodeDescription node) { if (node == null) return false; return isFragmentOwner || node.isEditAllowed() || node instanceof IUserLayoutChannelDescription; }
+ "."); 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 " if (parent == null || !(node.isMoveAllowed() || isFragmentOwner)) return false; Enumeration sibIds = getVisibleChildIds(parent.getId()); List sibs = Collections.list(sibIds); if (prev.getId().equals(nextSiblingId)) return true;
.getUserLayoutManager(); if (!ulm.getNode(targetId).isEditAllowed()) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView(
boolean nbhMoveAld = nbh.isMoveAllowed(); boolean hopperMoveAld = hopper.isMoveAllowed(); double Pnbh = nbh.getPrecedence(); double Ph = hopper.getPrecedence();
@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 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 }
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 (FOLDER.equals(nodeDescription.getType()) && nodeDescription instanceof IUserLayoutFolderDescription) {
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. }
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 }