<?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: Add an aspect to large number of nodes in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73508#M23665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Angel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes that's somewhat how I'm adding the aspect. The problem being :&lt;/P&gt;&lt;P&gt;- I'm doing all that in a transaction.&lt;/P&gt;&lt;P&gt;- As soon as I enable behaviours again during this transaction then there's multiple behaviours that trigger and modify the node. I don't know how to enable AUDITABLE AFTER these behaviours finished triggering their changes in the same transaction. (Your code suggestion by disabling auditable only and letting the other behaviours trigger should fix this maybe ? I don't know when the line &lt;CODE&gt;policyBehaviourFilter&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;enableBehaviour&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;nodeRef&lt;SPAN class=""&gt;,&lt;/SPAN&gt;ContentModel&lt;SPAN class=""&gt;.&lt;/SPAN&gt;ASPECT_AUDITABLE&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt; &lt;/CODE&gt;is executed compared to the behaviours that modify the node)&lt;/P&gt;&lt;P&gt;- Again, when the transaction is committed, another behaviour comes in and modifies the node, changing auditable again.&lt;/P&gt;&lt;P&gt;This behaviour is binded on TRANSACTION_COMMIT, I should enable AUDITABLE after this behaviour did it's thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Apr 2019 11:31:59 GMT</pubDate>
    <dc:creator>kuliado</dc:creator>
    <dc:date>2019-04-17T11:31:59Z</dc:date>
    <item>
      <title>Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73500#M23657</link>
      <description>Hello,I have a little issue I don't know how to tackle properly and concerns performance.I need to process ~200k documents that are missing an aspect. First, I identified these documents with a mysql query to evaluate how many there are. These nodes have aspect X but are missing aspect Y, so I need</description>
      <pubDate>Thu, 11 Apr 2019 13:11:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73500#M23657</guid>
      <dc:creator>kuliado</dc:creator>
      <dc:date>2019-04-11T13:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73501#M23658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IMO the best approach is to use REST API with pagination. So you can patch documents by blocks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2019 14:14:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73501#M23658</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-04-11T14:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73502#M23659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer Angel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I ask you to be more specific on your approach ? How would you get these nodes, /search endpoint ? And how would you patch them, /nodes/{nodeid} PUT ?&lt;/P&gt;&lt;P&gt;I need to prevent changing the modifier/modified properties while doing this and prevent all behaviour for performance could be a good idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 06:06:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73502#M23659</guid>
      <dc:creator>kuliado</dc:creator>
      <dc:date>2019-04-12T06:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73503#M23660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is mainly the idea, get the nodes with "/search" pages and add the aspect with "/nodes/{nodeid}".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can disable AUDITABLE Behaviour to avoid the change of the modification properties.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 07:24:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73503#M23660</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-04-12T07:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73504#M23661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help. My solution is working now just I have to decide on the number of nodes to fix per loop performance wise. It takes around 7s for the transaction that fixes 20 nodes to finish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing I can't prevent and is fundamental to approve my code is the change in modification properties. In my transaction I do a behaviourFilter.disableBehaviour(); then reenable at the end, but the nodes still show "Modified by System".&lt;/P&gt;&lt;P&gt;I see in the logs that as soon as I reenable the behaviours a few other custom behaviours trigger on these nodes and modifiy them, I suppose if they use current user context then this must be why modified &amp;amp; modifier change to System ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea how to solve this if my supposition is right ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 10:21:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73504#M23661</guid>
      <dc:creator>kuliado</dc:creator>
      <dc:date>2019-04-12T10:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73505#M23662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use a behaviour to control that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps: &lt;A class="link-titled" href="https://muras.eu/2013/05/23/Change-values-of-properties-included-in-cm-auditable-aspect-cm-creator,-cm-modifier,-cm-created,-cm-modified,-cm-accessed-in-Alfresco/" title="https://muras.eu/2013/05/23/Change-values-of-properties-included-in-cm-auditable-aspect-cm-creator,-cm-modifier,-cm-created,-cm-modified,-cm-accessed-in-Alfresco/" rel="nofollow noopener noreferrer"&gt;Change values of properties included in ‘cm:auditable’ aspect: cm:creator, cm:modifier, cm:created, cm:modified, cm:acce…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 10:41:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73505#M23662</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-04-12T10:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73506#M23663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I implemented that behaviour and binded to EVERY_EVENT the onUpdateProperties to catch any changes where the new modifier prop is "System", the catch works, and I put old values back, all this inside disableBehaviour too to be sure.&lt;/P&gt;&lt;P&gt;Unfortunately the end result is still modifier = System. It seems a behaviour binded on onUpdateProperties TRANSACTION_COMMIT is always the last one to be executed and modifies the node, I know wich one it is since it shows in the logs, is there no way to order behaviour execution ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 14:02:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73506#M23663</guid>
      <dc:creator>kuliado</dc:creator>
      <dc:date>2019-04-12T14:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73507#M23664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know how are you doing the adding of the aspect. But this seudo-code should work...&lt;/P&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;policyBehaviourFilter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;disableBehaviour&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;nodeRef&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ContentModel&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ASPECT_AUDITABLE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;    nodeService&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;addAspect&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;nodeRef&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YOUR_NEW_ASPECT&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword token"&gt;finally&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;    policyBehaviourFilter&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;enableBehaviour&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;nodeRef&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ContentModel&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ASPECT_AUDITABLE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2019 14:29:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73507#M23664</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-04-12T14:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73508#M23665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Angel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes that's somewhat how I'm adding the aspect. The problem being :&lt;/P&gt;&lt;P&gt;- I'm doing all that in a transaction.&lt;/P&gt;&lt;P&gt;- As soon as I enable behaviours again during this transaction then there's multiple behaviours that trigger and modify the node. I don't know how to enable AUDITABLE AFTER these behaviours finished triggering their changes in the same transaction. (Your code suggestion by disabling auditable only and letting the other behaviours trigger should fix this maybe ? I don't know when the line &lt;CODE&gt;policyBehaviourFilter&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;enableBehaviour&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;nodeRef&lt;SPAN class=""&gt;,&lt;/SPAN&gt;ContentModel&lt;SPAN class=""&gt;.&lt;/SPAN&gt;ASPECT_AUDITABLE&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt; &lt;/CODE&gt;is executed compared to the behaviours that modify the node)&lt;/P&gt;&lt;P&gt;- Again, when the transaction is committed, another behaviour comes in and modifies the node, changing auditable again.&lt;/P&gt;&lt;P&gt;This behaviour is binded on TRANSACTION_COMMIT, I should enable AUDITABLE after this behaviour did it's thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:31:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73508#M23665</guid>
      <dc:creator>kuliado</dc:creator>
      <dc:date>2019-04-17T11:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73509#M23666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've create a sample project available at:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/aborroy/auditable-aspect-disable" title="https://github.com/aborroy/auditable-aspect-disable" rel="nofollow noopener noreferrer"&gt;GitHub - aborroy/auditable-aspect-disable: Alfresco Repository module to disable AUDITABLE ASPECT behaviour&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Include the QName of the aspect you are adding in &lt;STRONG&gt;alfresco-global.properties&lt;/STRONG&gt; to test the module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this works for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2019 13:07:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73509#M23666</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2019-04-17T13:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add an aspect to large number of nodes</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73510#M23667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow, that is amazing from your part. I never asked for so much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will test this as soon as I can implement it with my code.&lt;/P&gt;&lt;P&gt;I already learned how to listen and execute code after the transaction is completed thanks to you with &lt;SPAN class=""&gt;TransactionListenerAdapter&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A million thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2019 13:52:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/add-an-aspect-to-large-number-of-nodes/m-p/73510#M23667</guid>
      <dc:creator>kuliado</dc:creator>
      <dc:date>2019-04-18T13:52:42Z</dc:date>
    </item>
  </channel>
</rss>

