<?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 Re: removing children in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299108#M252238</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your code works fine in my environment ,I 'm using alfresco 4.2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems you alfresco version dose not have removeNode method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;strong&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can't find method org.alfresco.repo.jscript.ScriptNode.removeNode(org.mozilla.javascript.Undefined)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/strong&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 May 2014 00:34:07 GMT</pubDate>
    <dc:creator>kaynezhang</dc:creator>
    <dc:date>2014-05-16T00:34:07Z</dc:date>
    <item>
      <title>removing children</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299107#M252237</link>
      <description>I need to bulk create a bunch of spaces (Alfresco Explorer 3.1.2) that are exactly modeled on other spaces.&amp;nbsp; Unfortunately the spaces being duplicated are full of stuff, so I was trying to script it.&amp;nbsp; I was testing a single copy like so:var newNode = document.copy(document.parent, false);newNode.nam</description>
      <pubDate>Thu, 15 May 2014 23:01:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299107#M252237</guid>
      <dc:creator>abruzzi</dc:creator>
      <dc:date>2014-05-15T23:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: removing children</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299108#M252238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your code works fine in my environment ,I 'm using alfresco 4.2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems you alfresco version dose not have removeNode method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;strong&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can't find method org.alfresco.repo.jscript.ScriptNode.removeNode(org.mozilla.javascript.Undefined)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/strong&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 00:34:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299108#M252238</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-05-16T00:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: removing children</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299109#M252239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you look at the error, you will find out that the node you are trying to remove is javascript undefined.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason, you are trying to delete a non existing node.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I suppose you want the second parameter to be true to allow a deep copy, which means copy all children.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Well I think this the cause of the problem,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 07:37:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299109#M252239</guid>
      <dc:creator>leonardo_celati</dc:creator>
      <dc:date>2014-05-16T07:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: removing children</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299110#M252240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually I don't want the deep copy–I was hoping that the 'false' would copy the folder without the children.&amp;nbsp; instead it copies the folder with references to the reference folders children.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was looking at the undefined being passed to the removeNode method, but to be honest, I've use similar loops to iterate over a series of child nodes without a problem.&amp;nbsp; I can't honestly tell wether the error is the lack of removeNode method, or a undefined being passed in. I've been working off the javascript API for 3.1 and I'm running 3.1.2 so I'd think the docs are accurate.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 14:40:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299110#M252240</guid>
      <dc:creator>abruzzi</dc:creator>
      <dc:date>2014-05-16T14:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: removing children</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299111#M252241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Understood, just an idea, shouldn't the loop start from the bottom instead of the beginning ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Infact it is not clear to me, if you remove the very first node, what happen to the children nodes, are they going to be deleted or just existing as "orphan" ? That could explain the undefined.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:57:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299111#M252241</guid>
      <dc:creator>leonardo_celati</dc:creator>
      <dc:date>2014-05-16T16:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: removing children</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299112#M252242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;arrgh! You're right–an idiot move on my part.&amp;nbsp; Instead of reversing the for loop, I changed it to a while:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var newNode = document.copy(document.parent, false);&lt;BR /&gt;newNode.name = "1909";&lt;BR /&gt;&lt;BR /&gt;while (newNode.children.length&amp;gt;0) {&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newNode.removeNode(newNode.children[0]);&lt;BR /&gt;&lt;BR /&gt;}&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;/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;SPAN&gt;thanks for the pointer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Geof&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 21:21:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/removing-children/m-p/299112#M252242</guid>
      <dc:creator>abruzzi</dc:creator>
      <dc:date>2014-05-16T21:21:00Z</dc:date>
    </item>
  </channel>
</rss>

