throws PortalException
{
if( canUpdateNode( node ) )
{
String nodeId = node.getId();
IUserLayoutNodeDescription oldNode = getNode( nodeId );
if( oldNode instanceof IUserLayoutChannelDescription )
{
IUserLayoutChannelDescription oldChanDesc = (IUserLayoutChannelDescription) oldNode;
if (!(node instanceof IUserLayoutChannelDescription))
{
throw new PortalException("Change channel to folder is "
+ "not allowed by updateNode() method! Occurred "
+ "in layout for "
+ owner.getAttribute(IPerson.USERNAME) + ".");
}
IUserLayoutChannelDescription newChanDesc =
(IUserLayoutChannelDescription) node;
updateChannelNode(nodeId, newChanDesc, oldChanDesc);
// inform the listeners
final String parentNodeId = this.getParentId(nodeId);
final IUserLayoutNodeDescription parentNode = this.getNode(parentNodeId);
LayoutEvent ev = new LayoutEvent(this, parentNode, node);
for (Iterator i = listeners.iterator(); i.hasNext();)
{
LayoutEventListener lel = (LayoutEventListener) i.next();
lel.channelUpdated(ev);
}
}
else
{
// must be a folder
IUserLayoutFolderDescription oldFolderDesc=(IUserLayoutFolderDescription) oldNode;
if (oldFolderDesc.getId().equals(getRootFolderId()))
throw new PortalException("Update of root node is not currently allowed!");
if( node instanceof IUserLayoutFolderDescription )
{
IUserLayoutFolderDescription newFolderDesc=(IUserLayoutFolderDescription) node;
updateFolderNode(nodeId, newFolderDesc, oldFolderDesc);
// inform the listeners
final String parentNodeId = this.getParentId(nodeId);
final IUserLayoutNodeDescription parentNode = this.getNode(parentNodeId);
LayoutEvent ev=new LayoutEvent(this, parentNode, node);
for(Iterator i=listeners.iterator();i.hasNext();) {
LayoutEventListener lel=(LayoutEventListener)i.next();
lel.folderUpdated(ev);
}