<?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: How to get the proper exception message to the CMIS client in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50076#M19221</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All you need to do is set the NotificationFrequency to EVERY_EVENT in the initialization method of your policy.&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 8.5pt;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public class CustomDocPolicy&lt;/SPAN&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;implements &lt;/SPAN&gt;NodeServicePolicies.OnCreateNodePolicy,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NodeServicePolicies.OnUpdateNodePolicy,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NodeServicePolicies.BeforeDeleteNodePolicy {&lt;/PRE&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 8.5pt;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 8.5pt;"&gt;&lt;SPAN style="font-weight: bold;"&gt;public void &lt;/SPAN&gt;initialise() {&lt;/PRE&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt; this&lt;/SPAN&gt;.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;policyComponent&lt;/SPAN&gt;.bindClassBehaviour(QName.&lt;SPAN&gt;createQName&lt;/SPAN&gt;(NamespaceService.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;ALFRESCO_URI&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"onCreateNode"&lt;/SPAN&gt;),&lt;BR /&gt; CustomConstants.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;TYPE_BASE_DOC&lt;/SPAN&gt;, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;JavaBehaviour(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;this&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"onCreateNode"&lt;/SPAN&gt;, Behaviour.NotificationFrequency.&lt;STRONG&gt;EVERY_EVENT&lt;/STRONG&gt;));&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2018 13:32:02 GMT</pubDate>
    <dc:creator>signjoy</dc:creator>
    <dc:date>2018-07-12T13:32:02Z</dc:date>
    <item>
      <title>How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50070#M19215</link>
      <description>Hi,We have a policy that moves the document according to the metadata called state id. So if the state id is 123456. It will move the document to 123 -&amp;gt; 456 -&amp;gt; 123456 -&amp;gt; c.pdfAs and when document comes into&amp;nbsp; Alfresco through JAVA CMIS call, we check using NodeService whether the document is</description>
      <pubDate>Thu, 28 Jun 2018 14:30:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50070#M19215</guid>
      <dc:creator>signjoy</dc:creator>
      <dc:date>2018-06-28T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50071#M19216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will never get the proper exception message from a transaction-level policy (bound using NotificationFrequency.TRANSACTION_COMMIT) to any client - CMIS or otherwise. All exceptions from such policies are wrapped and only via a stacktrace (not available to clients) could you get at the real cause.&lt;/P&gt;&lt;P&gt;This is one of the &lt;STRONG&gt;many&lt;/STRONG&gt; reasons I typically recommend to NOT use transaction-level policies at all, and none of the policies I write are ever transaction-level. I do use custom transaction listeners combined with regular EVERY_EVENT policies on occasion to aggregate multiple events into a single processing step at the end of a transaction, but at least if a listener throws an exception, it is not wrapped excessively on the way up the call-chain.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2018 08:13:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50071#M19216</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-06-29T08:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50072#M19217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;B&gt;Axel Faust&lt;/B&gt;‌&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I keep policy for EVERY_EVENT then it will be called multiple times for a single file. I need to keep checking the metadata whether they are updated or not that I want to manipulate. So if I have 20 metadata then the code will run 20 times.. is that a good practice ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But yes I have tested with EVERY_EVENT and it shows the actual exception thrown by the policy...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2018 17:46:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50072#M19217</guid>
      <dc:creator>signjoy</dc:creator>
      <dc:date>2018-06-29T17:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50073#M19218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will only get called 20 times for 20 properties if some code in Alfresco is extremely inefficient and calling NodeService.setProperty for each property instead of calling NodeService.addProperties once for all properties.&amp;nbsp;Unfortunately, it looks like the Alfresco CMIS implementation is that inefficient (I just checked the source).&lt;/P&gt;&lt;P&gt;But still, you should check in the code of your policy if the change is actually interesting for you, and such a check can be implement quite efficiently with two gets on the before/after maps and a single call to EqualsHelper.nullSafeEquals to check for a change/no-change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alfresco will always recommend using TRANSACTION_COMMIT because they have to deal with a lot of unqualified 3rd-party / customer developers that do not know how to properly / efficiently implement an EVERY_EVENT policy. I just see too many problems with TRANSACTION_COMMIT in almost every customer project where a non-professional (i.e. someone with little Alfresco development experience) is working on behaviour code, because the people know even less about properly using that frequency than they regarding to EVERY_EVENT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2018 19:12:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50073#M19218</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-06-29T19:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50074#M19219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;B&gt;Axel Faust&lt;/B&gt;‌ for your time and information...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As we have lot of properties and CMIS calls I would rather stick to TRANSACTION_COMMIT option. But I understand why I was not able to catch the actual error message from the policy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2018 20:19:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50074#M19219</guid>
      <dc:creator>signjoy</dc:creator>
      <dc:date>2018-06-29T20:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50075#M19220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting approach, and I didn't know that class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;I do use custom transaction listeners combined with regular EVERY_EVENT policies on occasion to aggregate multiple events into a single processing step at the end of a transaction&lt;/BLOCKQUOTE&gt;&lt;P&gt;Do you mean something like this? &lt;A class="link-titled" href="https://angelborroy.wordpress.com/2015/05/22/alfresco-implementing-delete-behavior/" title="https://angelborroy.wordpress.com/2015/05/22/alfresco-implementing-delete-behavior/" rel="nofollow noopener noreferrer"&gt;Alfresco – Implementing delete behavior | Programming and So&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any sample code you can share using the approach you described?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2018 00:20:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50075#M19220</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2018-07-12T00:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper exception message to the CMIS client</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50076#M19221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All you need to do is set the NotificationFrequency to EVERY_EVENT in the initialization method of your policy.&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 8.5pt;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public class CustomDocPolicy&lt;/SPAN&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;implements &lt;/SPAN&gt;NodeServicePolicies.OnCreateNodePolicy,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NodeServicePolicies.OnUpdateNodePolicy,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NodeServicePolicies.BeforeDeleteNodePolicy {&lt;/PRE&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 8.5pt;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 8.5pt;"&gt;&lt;SPAN style="font-weight: bold;"&gt;public void &lt;/SPAN&gt;initialise() {&lt;/PRE&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt; this&lt;/SPAN&gt;.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;policyComponent&lt;/SPAN&gt;.bindClassBehaviour(QName.&lt;SPAN&gt;createQName&lt;/SPAN&gt;(NamespaceService.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;ALFRESCO_URI&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"onCreateNode"&lt;/SPAN&gt;),&lt;BR /&gt; CustomConstants.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;TYPE_BASE_DOC&lt;/SPAN&gt;, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;JavaBehaviour(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;this&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"onCreateNode"&lt;/SPAN&gt;, Behaviour.NotificationFrequency.&lt;STRONG&gt;EVERY_EVENT&lt;/STRONG&gt;));&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2018 13:32:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-the-proper-exception-message-to-the-cmis-client/m-p/50076#M19221</guid>
      <dc:creator>signjoy</dc:creator>
      <dc:date>2018-07-12T13:32:02Z</dc:date>
    </item>
  </channel>
</rss>

