/** * 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 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())); }
/** * 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 boolean isPortletFavorited(IUserLayout layout, String fname) { List<IUserLayoutNodeDescription> favorites = favoritesUtils.getFavoritePortletLayoutNodes(layout); for (IUserLayoutNodeDescription favorite : favorites) { if (favorite instanceof UserLayoutChannelDescription) { String channelId = ((UserLayoutChannelDescription) favorite).getChannelPublishId(); IPortletDefinition portletDefinition = portletDefinitionRegistry.getPortletDefinition(channelId); String favFName = portletDefinition.getFName(); if (fname != null && fname.equals(favFName)) { return true; } } } return false; }
(UserLayoutChannelDescription) result; try { if (!ulm.deleteNode(channelDescription.getChannelSubscribeId())) { logger.warn( "Error deleting the node"
IUserLayoutChannelDescription channel = new UserLayoutChannelDescription(definition);
final IUserLayoutManager ulm = upm.getUserLayoutManager(); final IUserLayoutChannelDescription channel = new UserLayoutChannelDescription(pdef);
protected IUserLayoutChannelDescription createUserLayoutChannelDescription( String nodeId, IPortletDefinition chanDef) { IUserLayoutChannelDescription ulnd = new UserLayoutChannelDescription(); ulnd.setId(nodeId); ulnd.setName(chanDef.getName()); ulnd.setUnremovable(true); ulnd.setImmutable(true); ulnd.setHidden(false); ulnd.setTitle(chanDef.getTitle()); ulnd.setDescription(chanDef.getDescription()); ulnd.setChannelPublishId("" + chanDef.getPortletDefinitionId().getStringId()); ulnd.setChannelTypeId("" + chanDef.getType().getId()); ulnd.setFunctionalName(chanDef.getFName()); ulnd.setTimeout(chanDef.getTimeout()); Set<IPortletDefinitionParameter> parms = chanDef.getParameters(); for (IPortletDefinitionParameter parm : parms) { ulnd.setParameterValue(parm.getName(), parm.getValue()); } return ulnd; }