AnsweredAssumed Answered

nodeService.create( ) question

Question asked by aweber1nj on Jan 30, 2013
Latest reply on Jan 30, 2013 by aweber1nj
Using an example found in the Alfresco docs, I am trying to create a new document-node using the nodeService.create method.  The problem is that despite reading the javadocs on the method, I don't truly understand what the middle parameters are denoting or being used for.

I am actually trying to "copy" the properties of an existing node, and put the copy of the node (with different content) into the same folder as the "original".  Thus, I get the original's type, and properties, then try to create the new document-node with these values (changing only the name property)…
<code lang="java">
docProps.put(ContentModel.PROP_NAME, name);
NodeRef childAtt = nodeService.createNode(parentFolderNodeRef,
           ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), type, docProps).getChildRef();

However, I get this exception:

org.alfresco.repo.domain.node.NodeExistsException: 00300011 Node already exists: (7397, workspace://SpacesStore/d1743f82-08b1-4f24-85ab-c949437239d8)
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNodeImpl(
        at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNode(
        at org.alfresco.repo.node.db.DbNodeServiceImpl.createNode(

I don't know if this is me creating that assocQName, or if there is some other property I should not be copying (or I should be replacing) from the original node.  Is there a reference to the QName ID's (i.e. 7397) that might tell me what Alfresco is complaining about being a duplicate?

Thanks in advance,