<?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: Result Variable in JavaDelegate in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208513#M161643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I see. What you can do with the current code, is to fetch the BpmnModel and inspect the service task and check what value was set for the result variable.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2015 12:26:11 GMT</pubDate>
    <dc:creator>jbarrez</dc:creator>
    <dc:date>2015-05-07T12:26:11Z</dc:date>
    <item>
      <title>Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208508#M161638</link>
      <description>Hi,When creating a BPMN model, there is a configuration field on a ServiceTask "Result variable". If my ServiceTask uses a delegateExpression backed by a JavaDelegate, can I access the value specified for "Result variable" so I can place the result in the requested variable?Maarten</description>
      <pubDate>Sun, 26 Apr 2015 10:02:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208508#M161638</guid>
      <dc:creator>boekhold</dc:creator>
      <dc:date>2015-04-26T10:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208509#M161639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The purpose of result variable is to save the service task result (for service task using expression only). For example,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;serviceTask id="serviceTask"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; activiti:expression="#{myService.toUpperCase(myVar)}"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; activiti:resultVariable="myVar" /&amp;gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;SPAN&gt;[java]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public class MyService {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; public String toUpperCase(String val) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return val.toUpperCase();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/java]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In above example, the myVar process variable will be updated to the value returned by the expression. This is useful when you want to use/build services that do not have dependency to Activiti.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When using JavaDelegate (either by using delegateExpression or using activiti:class attribute), the resultVariable has no meaning in that case since variables can be modified directly using the DelegateExecution instance (additionally the execute method return type is void). The above example can be done using the JavaDelegate as follows&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[java]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public class MyService implements JavaDelegate {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; public void execute(DelegateExecution execution) throws Exception {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String myVar = (String) execution.getVariable("myVar");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; execution.setVariable("myVar", myVar.toUpperCase());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/java]&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2015 19:37:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208509#M161639</guid>
      <dc:creator>balsarori</dc:creator>
      <dc:date>2015-04-26T19:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208510#M161640</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;Thanks for the explanation Bassam. I do actually think that using the result variable would be useful for a JavaDelegate service task as well, because it would allow the &lt;/SPAN&gt;&lt;EM&gt;workflow designer&lt;/EM&gt;&lt;SPAN&gt; to decide where the result should be stored, instead of being stuck with what the &lt;/SPAN&gt;&lt;EM&gt;JavaDelegate&lt;/EM&gt;&lt;SPAN&gt; programmer decided. That could help in cases where you have 2 JavaDelegates that both place their result in the same process variable, possibly overwriting each other's result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suppose I could always achieve the same thing by passing a result variable name as a Class Field though…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maarten&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 05:23:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208510#M161640</guid>
      <dc:creator>boekhold</dc:creator>
      <dc:date>2015-04-27T05:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208511#M161641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the JavaDelegate option, the way to go is execution.setVariable() indeed. A class field would solve that problem at design time indeed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; 'That could help in cases where you have 2 JavaDelegates that both place their result in the same process variable'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you elaborate what you mean with this? Or are you referring to the designer not having knowledge to the internals of a delegate?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 18:38:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208511#M161641</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-04-28T18:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208512#M161642</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;Any JavaDelegate implementation will have a 'contract' that defines how it expects its inputs to be provided, and where it will make its result available. For JavaDelegates, the only way you have to return a result is to place it in a process variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have multiple (independent) teams writing Java Delegates, they could unwittingly used the same "result variable name", and if you then put 2 of these Java Delegates one after another in your model, the second one would overwrite the results of the first one…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If "result variable" was available somewhere in the DelegateExecution, you can avoid that by handing off the responsibility of selecting proper result variable names to the model designer/business analyst.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maarten&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2015 11:44:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208512#M161642</guid>
      <dc:creator>boekhold</dc:creator>
      <dc:date>2015-04-29T11:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208513#M161643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I see. What you can do with the current code, is to fetch the BpmnModel and inspect the service task and check what value was set for the result variable.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 12:26:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208513#M161643</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-05-07T12:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208514#M161644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried setting a result variable on the service task executing a JavaDelegate, but there's a very early validation somewhere that prevents me from doing so. If I recall correctly, there's an exception on execution of the model.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 13:00:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208514#M161644</guid>
      <dc:creator>boekhold</dc:creator>
      <dc:date>2015-05-07T13:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Result Variable in JavaDelegate</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208515#M161645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm would be interesting to see if you can get that stacktrace back again. That should work as advertised.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 13:33:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/result-variable-in-javadelegate/m-p/208515#M161645</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-05-07T13:33:40Z</dc:date>
    </item>
  </channel>
</rss>

