<?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 Cannot get node content using onCreateNode behavior in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268744#M221874</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've created a custom Java behavior bound to the onCreateNode event that works just fine, except&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that I can't retrieve the content from the node using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;ContentReader cReader = contentService.getReader(car.getChildRef(), nodeService.getType(car.getChildRef()));&lt;BR /&gt;String content = cReader.getContentString();&lt;BR /&gt;//car is the retrieved ChildAssociationRef&amp;nbsp; &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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I just get an nullPointerException on the first mentioned line when i run the code while I'm able to retrieve other properties without problems. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm interested if this is a known issue and if there is a workaround for retrieving the content node.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The content in this case is a string contained in a comment post node. My suspicion is that ContentReader can't retrieve the content node because&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the node referenced is not yet available (not written) to alfresco at that moment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need more information, please let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Aug 2011 17:58:43 GMT</pubDate>
    <dc:creator>abraxas</dc:creator>
    <dc:date>2011-08-31T17:58:43Z</dc:date>
    <item>
      <title>Cannot get node content using onCreateNode behavior</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268744#M221874</link>
      <description>I've created a custom Java behavior bound to the onCreateNode event that works just fine, exceptthat I can't retrieve the content from the node using:ContentReader cReader = contentService.getReader(car.getChildRef(), nodeService.getType(car.getChildRef()));String content = cReader.getContentString(</description>
      <pubDate>Wed, 31 Aug 2011 17:58:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268744#M221874</guid>
      <dc:creator>abraxas</dc:creator>
      <dc:date>2011-08-31T17:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get node content using onCreateNode behavior</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268745#M221875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's been a while since you asked this but I see it hasn't been answered yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had the same problem using a javascript behaviour. My solution was to use the onContentChanged behaviour instead.&amp;nbsp; The signature is slightly different but it gets you access to the content and tells you if it's new content so you can simulate onCreateContent. Not a complete answer but hopefully it points you in the right direction.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2012 18:58:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268745#M221875</guid>
      <dc:creator>fiferyan</dc:creator>
      <dc:date>2012-03-06T18:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get node content using onCreateNode behavior</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268746#M221876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;just as an idea: I had a similar problem (the onCreateNode methode was called, but requesting the properties of the new node doesn't get me all of the expected properties). As soon as I specified the NotificationFrequency to be &lt;/SPAN&gt;&lt;EM&gt;TRANSACTION_COMMIT&lt;/EM&gt;&lt;SPAN&gt; everything is working fine:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;JavaBehaviour onCreateNodeBehaviour = new JavaBehaviour(this, "onCreateNode", NotificationFrequency.TRANSACTION_COMMIT);&lt;BR /&gt;policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, qNameOfMyType, onCreateNodeBehaviour);&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason seems to be, that the new node ist created (even with specialised type) which causes the event, and that later the additional properties are added. When you register to the onUpdateProperties event with default NotificationFrequency (= &lt;/SPAN&gt;&lt;EM&gt;EVERY_EVENT&lt;/EM&gt;&lt;SPAN&gt;) this event is raised twice. The first time the node contains only a few properties. The second time the others are present, too.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 14:35:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/cannot-get-node-content-using-oncreatenode-behavior/m-p/268746#M221876</guid>
      <dc:creator>larsg_</dc:creator>
      <dc:date>2014-11-10T14:35:51Z</dc:date>
    </item>
  </channel>
</rss>

