/** * Get the value of channelSubscribeId. * * @return value of channelSubscribeId. */ @Override public String getChannelSubscribeId() { return super.getId(); }
/** * 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(); }
/** * Set the value of channelSubscribeId. * * @param v Value to assign to channelSubscribeId. */ @Override public void setChannelSubscribeId(String v) { super.setId(v); }
@Override public void addNodeAttributes(Element node) { super.addNodeAttributes(node); node.setAttribute("title", this.getTitle()); node.setAttribute("name", this.getName()); node.setAttribute("description", this.getDescription()); node.setAttribute("class", this.getClassName()); node.setAttribute("chanID", this.getChannelPublishId()); node.setAttribute("typeID", this.getChannelTypeId()); node.setAttribute("fname", this.getFunctionalName()); node.setAttribute("timeout", String.valueOf(this.getTimeout())); node.setAttribute("editable", String.valueOf(this.isEditable())); node.setAttribute("hasHelp", String.valueOf(this.hasHelp())); node.setAttribute("hasAbout", String.valueOf(this.hasAbout())); node.setAttribute("secure", String.valueOf(this.isSecure())); node.setAttribute("isPortlet", String.valueOf(this.isPortlet())); }
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; }
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 }
/** * A factory method to create a <code>UserLayoutNodeDescription</code> instance, based on the * information provided in the user layout <code>Element</code>. * * @param xmlNode a user layout DTD folder/channel <code>Element</code> value * @return an <code>UserLayoutNodeDescription</code> value * @exception PortalException if the xml passed is somehow invalid. */ public static UserLayoutNodeDescription createUserLayoutNodeDescription(Element xmlNode) throws PortalException { // is this a folder or a channel ? String nodeName = xmlNode.getNodeName(); if (nodeName.equals("channel")) { return new UserLayoutChannelDescription(xmlNode); } else if (nodeName.equals("folder")) { return new UserLayoutFolderDescription(xmlNode); } else { throw new PortalException( "Given XML element '" + nodeName + "' is neither folder nor channel"); } }
@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 IUserLayoutNodeDescription createNodeDescription(LayoutNodeType nodeType) throws PortalException { if (nodeType == LayoutNodeType.FOLDER) { return new UserLayoutFolderDescription(); } return new ChannelDescription(); }
/** * 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; }
/** * Creates a <code>org.w3c.dom.Element</code> representation of the current channel. * * @param root a <code>Document</code> for which the <code>Element</code> should be created. * @return a <code>Node</code> value */ @Override public Element getXML(Document root) { Element node = root.createElement("channel"); this.addNodeAttributes(node); this.addParameterChildren(node, root); return node; }
private void addParameterChildren(Element node, Document root) { for (Enumeration enum1 = this.getParameterNames(); enum1.hasMoreElements(); ) { Element pElement = root.createElement("parameter"); String pName = (String) enum1.nextElement(); pElement.setAttribute("name", pName); pElement.setAttribute("value", getParameterValue(pName)); node.appendChild(pElement); } }
/** * Creates a <code>org.w3c.dom.Element</code> representation of the current node. * * @param root a <code>Document</code> for which the <code>Element</code> should be created. * @return a <code>Node</code> value */ @Override public Element getXML(Document root) { Element node = root.createElement("folder"); this.addNodeAttributes(node); return node; }
@Override public void addNodeAttributes(Element node) { super.addNodeAttributes(node); node.setAttribute("type", this.folderType); }
@Override public String toString() { return new ToStringBuilder(this) .append("ID", this.id) .append("name", this.name) .append("channel_or_folder?", this.getType()) .append("precedence", this.precedence) .append("moveAllowed", this.moveAllowed) .append("removable", !this.unremovable) .append("deleteAllowed", this.deleteAllowed) .append("immutable", this.immutable) .append("editAllowed", this.editAllowed) .append("precedence", this.precedence) .toString(); } }
@Override public IUserLayoutNodeDescription getNodeDescription(String nodeId) throws PortalException { Element element = layout.getElementById(nodeId); return UserLayoutNodeDescription.createUserLayoutNodeDescription(element); }
@Override public String toString() { return new ToStringBuilder(this) .append("ID", this.id) .append("name", this.name) .append("channel_or_folder?", this.getType()) .append("type", this.folderType) .append("precedence", this.precedence) .append("moveAllowed", this.moveAllowed) .append("removable", !this.unremovable) .append("deleteAllowed", this.deleteAllowed) .append("immutable", this.immutable) .append("editAllowed", this.editAllowed) .append("precedence", this.precedence) .toString(); } }
@Override public String toString() { return new ToStringBuilder(this) .append("ID", this.id) .append("name", this.name) .append("channelPublishId", this.channelPublishId) .append("channelTypeId", this.channelTypeId) .append("nodeType", this.getType()) .append("precedence", this.precedence) .append("moveAllowed", this.moveAllowed) .append("removable", !this.unremovable) .append("deleteAllowed", this.deleteAllowed) .append("immutable", this.immutable) .append("editAllowed", this.editAllowed) .append("precedence", this.precedence) .toString(); } }
@Override public Element getXML(Document root) { Element node = super.getXML(root); // now add in DLM specific attributes if found if (getPlfId() != null) node.setAttributeNS(Constants.NS_URI, Constants.ATT_PLF_ID, getPlfId()); if (getOrigin() != null) node.setAttributeNS(Constants.NS_URI, Constants.ATT_ORIGIN, getOrigin()); return node; } }