From a0a304d900015dd81b27927fc341f69775e369fc Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Wed, 8 Nov 2006 15:37:40 +0000 Subject: [PATCH] . Copy of nodes (recursive) now supported in AVM JavaScript integration - this completes the standard set of CRUD operations for AVM nodes in JavaScript land git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4315 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/jscript/AVMNode.java | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/source/java/org/alfresco/repo/jscript/AVMNode.java b/source/java/org/alfresco/repo/jscript/AVMNode.java index 25078c4b2c..f5f191a881 100644 --- a/source/java/org/alfresco/repo/jscript/AVMNode.java +++ b/source/java/org/alfresco/repo/jscript/AVMNode.java @@ -16,12 +16,8 @@ */ package org.alfresco.repo.jscript; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.mozilla.javascript.Scriptable; @@ -89,12 +85,47 @@ public class AVMNode extends Node return getPath(); } - /*@Override + /** + * Copy this Node into a new parent destination. + * + * @param destination Parent node for the copy + * + * @return the copy of this node + */ + @Override public Node copy(Node destination) { - AVM - this.services.getAVMService(). - }*/ + Node copy = null; + + if (destination instanceof AVMNode) + { + copy = copy(((AVMNode)destination).getPath()); + } + + return copy; + } + + /** + * Copy this Node into a new parent destination. + * + * @param destination Parent path for the copy + * + * @return the copy of this node + */ + public Node copy(String destination) + { + Node copy = null; + + if (destination != null && destination.length() != 0) + { + this.services.getAVMService().copy(-1, getPath(), destination, getName()); + copy = newInstance( + AVMNodeConverter.ToNodeRef(-1, destination + '/' + getName()), + this.services, null, this.scope); + } + + return copy; + } /** * Move this Node to a new parent destination node.