<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic nodeService.create( ) question in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272340#M225470</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using an example found in the Alfresco docs, I am trying to create a new document-node using the nodeService.create method.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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".&amp;nbsp; 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)…&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code lang="java"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;docProps.put(ContentModel.PROP_NAME, name);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NodeRef childAtt = nodeService.createNode(parentFolderNodeRef,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), type, docProps).getChildRef();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I get this exception:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt; org.alfresco.repo.domain.node.NodeExistsException: 00300011 Node already exists: (7397, workspace://SpacesStore/d1743f82-08b1-4f24-85ab-c949437239d8)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNodeImpl(AbstractNodeDAOImpl.java:1180)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNode(AbstractNodeDAOImpl.java:1066)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.alfresco.repo.node.db.DbNodeServiceImpl.createNode(DbNodeServiceImpl.java:361)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; Is there a reference to the QName ID's (i.e. 7397) that might tell me what Alfresco is complaining about being a duplicate?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AJ&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jan 2013 16:19:50 GMT</pubDate>
    <dc:creator>aweber1nj</dc:creator>
    <dc:date>2013-01-30T16:19:50Z</dc:date>
    <item>
      <title>nodeService.create( ) question</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272340#M225470</link>
      <description>Using an example found in the Alfresco docs, I am trying to create a new document-node using the nodeService.create method.&amp;nbsp; 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 "cop</description>
      <pubDate>Wed, 30 Jan 2013 16:19:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272340#M225470</guid>
      <dc:creator>aweber1nj</dc:creator>
      <dc:date>2013-01-30T16:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: nodeService.create( ) question</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272341#M225471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Its probably easier if you use the FileFolderService.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if you want to use the node service there are two "names" that matter.&amp;nbsp;&amp;nbsp; There's a name property on a node and the name of the association to the parent.&amp;nbsp;&amp;nbsp; FileFolderService looks after this detail by making both values the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Its the name of the association that's causing you problems because there's a constraint to stop duplicate names.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2013 16:36:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272341#M225471</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2013-01-30T16:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: nodeService.create( ) question</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272342#M225472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I looked at FileFolderService as an alternative, but since I really only wanted to copy the Properties, and set new content, and that FileFolderService returns a FileInfo object makes it add some additional steps…it seemed like it (FileFolderService.create or .copy) was trying to make things simpler, but in my case it would actually&amp;nbsp; make things more complex.&amp;nbsp; I appreciate the tip, though.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With further testing, I found that the actual/current issue was if you copy (all) the properties from one node to another, you necessarily copy all the sys-namespace properties, and many of those are, of course, unique and system-defined.&amp;nbsp; One would THINK that even if I supply these properties as part of the nodeService.create( ), it would ignore them and generate its own – for example, passing a DBID to any node-create method should be ignored IMHO, but simply filtering-out all sys-namespace properties in my code seems to be working now (more testing needed, for sure).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But you absolutely touch-upon another issue I have not thoroughly resolved, and would think would be provided by some Alfresco API – but I haven't found it:&amp;nbsp; Ensuring unique node-names within a folder (or within that part of the tree in general).&amp;nbsp; Is there any util/method provided to pass a folder nodeRef (parent) and a "proposed name", and have Alfresco either validate that the name is unique, or return a "possible, unique alternative" (hopefully based upon the "proposed name"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks very much for the quick reply!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-AJ&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2013 17:20:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/nodeservice-create-question/m-p/272342#M225472</guid>
      <dc:creator>aweber1nj</dc:creator>
      <dc:date>2013-01-30T17:20:51Z</dc:date>
    </item>
  </channel>
</rss>

