<?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 a document of one process and show it in other process? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21297#M9375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Axel,&lt;BR /&gt;Thank you, it works whit this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Component&lt;BR /&gt;public class RetieveAttachment implements JavaDelegate {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Autowired&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;UserService userService;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Autowired&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;RelatedContentService relatedContentService;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Autowired&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;RelatedContentStreamProvider relatedContentStreamProvider;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Override&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void execute(DelegateExecution execution) throws Exception {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println("*******************&amp;nbsp; RetieveAttachment&amp;nbsp; *******************");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;User user = userService.findUser(Long.parseLong("1"));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println("Usuario: " + user.getFullName());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;// Look up the document via the related content service&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;List&amp;lt;RelatedContent&amp;gt; contentList = relatedContentService&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.getFieldContentForProcessInstance(execution.getVariable("varGlo_idProceso").toString(),&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"form_scfhq_marcos_ini_englishframeworkversion", 1, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.getContent();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ContentObject contentObject = null;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;InputStream inputStreamContent = null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (contentList != null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (RelatedContent relCon : contentList) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println("Content file: " + relCon.getName() + ", created: " + relCon.getCreated());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;contentObject = relatedContentService.getContentStorage().getContentObject(relCon.getContentStoreId());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;// Obtain its stream from the stream provider&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;inputStreamContent = relatedContentStreamProvider.getContentStream(relCon);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;// Create a new related content again via the related content service&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;relatedContentService.setContentField(relCon.getId(), "attachment", execution.getProcessInstanceId(), null, true);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the other hand, I would like to show the document and can download from the form.&lt;/P&gt;&lt;P&gt;I can see it in my form:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16189_pastedImage_4.png" style="width: 620px; height: 122px;" /&gt;&lt;/P&gt;&lt;P&gt;But i need download this document for work about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I configured the field form like 'Attach' with this properties:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16190_pastedImage_5.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16191_pastedImage_6.png" style="width: 620px; height: 466px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Sep 2017 08:32:14 GMT</pubDate>
    <dc:creator>deivid</dc:creator>
    <dc:date>2017-09-20T08:32:14Z</dc:date>
    <item>
      <title>How to get a document of one process and show it in other process?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21295#M9373</link>
      <description>Hi,I need to recuperate a document from one process and show this document in other form of other process.I have two process:This is the first process with the document. It call to 'activiti call'.The second process need to recuperate the document and show it in the form:With Java i can recuperate t</description>
      <pubDate>Tue, 19 Sep 2017 15:49:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21295#M9373</guid>
      <dc:creator>deivid</dc:creator>
      <dc:date>2017-09-19T15:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a document of one process and show it in other process?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21296#M9374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I implemented something in that direction for a customer of mine this year.&amp;nbsp;This was required for passing a document from one process into another (child). For that I developed an execution listener in the child process that would use the process instance ID (and other parameters) provided by the parent process via variable mapping, look up the related contents and re-create them for itself.&lt;/P&gt;&lt;P&gt;The RelatedContentService and RelatedContentStreamProvider is all you should need for this. You look up the&amp;nbsp;document via the related content service (like you already do), obtain its stream from the stream provider, and can then create a new related content again via the related content service. Once stored in as a related content for another process you can then show it in a form of that process with the typical attachment form field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2017 16:23:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21296#M9374</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-09-19T16:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a document of one process and show it in other process?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21297#M9375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Axel,&lt;BR /&gt;Thank you, it works whit this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Component&lt;BR /&gt;public class RetieveAttachment implements JavaDelegate {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Autowired&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;UserService userService;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Autowired&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;RelatedContentService relatedContentService;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Autowired&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;RelatedContentStreamProvider relatedContentStreamProvider;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Override&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void execute(DelegateExecution execution) throws Exception {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println("*******************&amp;nbsp; RetieveAttachment&amp;nbsp; *******************");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;User user = userService.findUser(Long.parseLong("1"));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println("Usuario: " + user.getFullName());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;// Look up the document via the related content service&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;List&amp;lt;RelatedContent&amp;gt; contentList = relatedContentService&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.getFieldContentForProcessInstance(execution.getVariable("varGlo_idProceso").toString(),&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"form_scfhq_marcos_ini_englishframeworkversion", 1, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.getContent();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ContentObject contentObject = null;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;InputStream inputStreamContent = null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (contentList != null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (RelatedContent relCon : contentList) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println("Content file: " + relCon.getName() + ", created: " + relCon.getCreated());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;contentObject = relatedContentService.getContentStorage().getContentObject(relCon.getContentStoreId());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;// Obtain its stream from the stream provider&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;inputStreamContent = relatedContentStreamProvider.getContentStream(relCon);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;// Create a new related content again via the related content service&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;relatedContentService.setContentField(relCon.getId(), "attachment", execution.getProcessInstanceId(), null, true);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the other hand, I would like to show the document and can download from the form.&lt;/P&gt;&lt;P&gt;I can see it in my form:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16189_pastedImage_4.png" style="width: 620px; height: 122px;" /&gt;&lt;/P&gt;&lt;P&gt;But i need download this document for work about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I configured the field form like 'Attach' with this properties:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16190_pastedImage_5.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://connect.hyland.com/legacyfs/online/alfresco/16191_pastedImage_6.png" style="width: 620px; height: 466px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2017 08:32:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21297#M9375</guid>
      <dc:creator>deivid</dc:creator>
      <dc:date>2017-09-20T08:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a document of one process and show it in other process?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21298#M9376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure that code is really the best choice. Have you tried deleting the attachment in the parent process? How does it relate to the attachment in the project where it was copied to? We had several issues with the whole attachment management (which is really awkward) which is why I opted to fully copy the attachment (as in "duplicate it") instead of just linking it in my field as you have done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards to the download question - I am not sure what would affect this, for us it did "just work". BTW: We are using 1.6.0, so maybe you have a different / older version that I am not as familiar with.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Sep 2017 13:23:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-a-document-of-one-process-and-show-it-in-other/m-p/21298#M9376</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-09-20T13:23:23Z</dc:date>
    </item>
  </channel>
</rss>

