<?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: Update content using Rule in background in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3417#M1297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kayne,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is a portion of the action-executer. Add aspect to the &lt;SPAN&gt;actionedUponNodeRef&amp;nbsp;&lt;/SPAN&gt;gives the &lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;ConcurrencyFailureException.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #3d3d3d;"&gt;actionedUponNodeRef is the document itself and I can get the bytes without problems&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;We are using the Asynchronous calls of the actionExecuter from web-script call like the following and works well:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE style="color: #000000; font-size: 9.0pt;"&gt;Action action = getServiceRegistry().getActionService().createAction(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"lock-folder"&lt;/SPAN&gt;, params);&lt;BR /&gt;action.setExecuteAsynchronously(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;true&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;But my question is how to call an action-executer asynchronously&amp;nbsp;from inside a&amp;nbsp;rule? (no option for that)&lt;/P&gt;&lt;P&gt;Do I need to add some code for that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;public class LockFileRuleActionExecuter extends ActionExecuterAbstractBase {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; @Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; protected void addParameterDefinitions(List&amp;lt;ParameterDefinition&amp;gt; paramList) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; paramList.add(new ParameterDefinitionImpl(PARAM_COMMENT,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_COMMENT)));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; @Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; if (m_nodeService.exists(actionedUponNodeRef)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; if (!getNodeService().hasAspect(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.ASPECT_LOCK)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; // add the aspect with properties (first time access)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().addAspect(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.ASPECT_LOCK, new HashMap&amp;lt;QName, Serializable&amp;gt;());&lt;SPAN style="color: #ff0000;"&gt;&amp;lt;---Exception&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().setProperty(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.PROP_LOCKTO, "fullName");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().setProperty(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.PROP_LOCKDATE, new java.util.Date());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().setProperty(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.PROP_LOCKBY, "fullName");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;//add aspects&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; m_alfrescoRepoHelper.updateContent(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, signedDoc2, true);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; else{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; action.setParameterValue(PARAM_RESULT, "Can't lock a locked document");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jan 2017 08:56:00 GMT</pubDate>
    <dc:creator>jamilnour</dc:creator>
    <dc:date>2017-01-19T08:56:00Z</dc:date>
    <item>
      <title>Update content using Rule in background</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3413#M1293</link>
      <description>Hello,I created an action-executer to change and replace&amp;nbsp;the content of a document. I used this action to create a Rule and the rule is working fine and the document is well replaced.But when I choose to Run the Rule in background I have the action not working with the following&amp;nbsp;error when trying to</description>
      <pubDate>Tue, 17 Jan 2017 20:23:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3413#M1293</guid>
      <dc:creator>jamilnour</dc:creator>
      <dc:date>2017-01-17T20:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update content using Rule in background</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3414#M1294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems two threads &amp;nbsp;try to concurrently modify the same node&amp;nbsp;&lt;BR /&gt;Please check if there is another thread (job or action or another rule still have effect that trigger your action) try to modify the node when your action-executer is triggered&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 02:55:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3414#M1294</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2017-01-18T02:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Update content using Rule in background</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3415#M1295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it is clear that what you said is happen. I don't have any other rule or action running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the action-executer is run during the entering of the document inside the folder but how to make sure the document and the node is ready to be updated? How "Rule in background" is working? and what is the difference between "Run in background" and "Run normally".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems Run normally means that after the document is uploaded and entered the folder the Rule is started so my Rule is well working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My action-executer is written in java so what to add to tell to wait until the noderef is ready to be replaced?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 07:34:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3415#M1295</guid>
      <dc:creator>jamilnour</dc:creator>
      <dc:date>2017-01-18T07:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update content using Rule in background</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3416#M1296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Run normally tells the action to be executed synchronously,and it is in the same transaction with calling method&lt;BR /&gt;Run in background Indicates the rule should execute the action asynchronously ,it is running in its own transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you error may be caused by transactions ,could you please paste your action java code here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 02:46:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3416#M1296</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2017-01-19T02:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Update content using Rule in background</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3417#M1297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kayne,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is a portion of the action-executer. Add aspect to the &lt;SPAN&gt;actionedUponNodeRef&amp;nbsp;&lt;/SPAN&gt;gives the &lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;ConcurrencyFailureException.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #3d3d3d;"&gt;actionedUponNodeRef is the document itself and I can get the bytes without problems&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;We are using the Asynchronous calls of the actionExecuter from web-script call like the following and works well:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE style="color: #000000; font-size: 9.0pt;"&gt;Action action = getServiceRegistry().getActionService().createAction(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"lock-folder"&lt;/SPAN&gt;, params);&lt;BR /&gt;action.setExecuteAsynchronously(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;true&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;But my question is how to call an action-executer asynchronously&amp;nbsp;from inside a&amp;nbsp;rule? (no option for that)&lt;/P&gt;&lt;P&gt;Do I need to add some code for that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;public class LockFileRuleActionExecuter extends ActionExecuterAbstractBase {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; @Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; protected void addParameterDefinitions(List&amp;lt;ParameterDefinition&amp;gt; paramList) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; paramList.add(new ParameterDefinitionImpl(PARAM_COMMENT,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_COMMENT)));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; @Override&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; if (m_nodeService.exists(actionedUponNodeRef)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; if (!getNodeService().hasAspect(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.ASPECT_LOCK)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; // add the aspect with properties (first time access)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().addAspect(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.ASPECT_LOCK, new HashMap&amp;lt;QName, Serializable&amp;gt;());&lt;SPAN style="color: #ff0000;"&gt;&amp;lt;---Exception&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().setProperty(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.PROP_LOCKTO, "fullName");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().setProperty(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.PROP_LOCKDATE, new java.util.Date());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; getNodeService().setProperty(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, IndorseModel.PROP_LOCKBY, "fullName");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;//add aspects&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; m_alfrescoRepoHelper.updateContent(&lt;SPAN&gt;actionedUponNodeRef&lt;/SPAN&gt;, signedDoc2, true);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; else{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; action.setParameterValue(PARAM_RESULT, "Can't lock a locked document");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 08:56:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3417#M1297</guid>
      <dc:creator>jamilnour</dc:creator>
      <dc:date>2017-01-19T08:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Update content using Rule in background</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3418#M1298</link>
      <description>&lt;P&gt;any update on this?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 21:19:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/update-content-using-rule-in-background/m-p/3418#M1298</guid>
      <dc:creator>krutik_jayswal</dc:creator>
      <dc:date>2021-02-22T21:19:18Z</dc:date>
    </item>
  </channel>
</rss>

