<?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: Multi-step document transformation in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24831#M12200</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a transformer that iterates over the parts, requests a transformer from the registry, creates a new ContentReader from a temp file and fires transformer#transform. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately this step tries to get a new writable channel which fails because there is already a writer. So I created a new writer from a temp file but then the fulltext search does not find my file because only a temporary file is indexed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So how do I append the text of my sub-parts to the writer of my file?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jan 2006 12:38:30 GMT</pubDate>
    <dc:creator>cburghardt</dc:creator>
    <dc:date>2006-01-06T12:38:30Z</dc:date>
    <item>
      <title>Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24829#M12198</link>
      <description>I want to store a file in alfresco which is has a mimetype that is not known to the repository yet. The file has nested content - think of a zip-file that contains other files. Is it possible to create a transformer that extracts the nested content and passes these normal files (pdf, text, whatever)</description>
      <pubDate>Wed, 04 Jan 2006 15:21:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24829#M12198</guid>
      <dc:creator>cburghardt</dc:creator>
      <dc:date>2006-01-04T15:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24830#M12199</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;It seems that you require a transformer from the new mimetype to &lt;/SPAN&gt;&lt;STRONG&gt;text/plain&lt;/STRONG&gt;&lt;SPAN&gt;.&amp;nbsp; This is quite easy to do and set up.&amp;nbsp; Read the section in the WIKI on &lt;/SPAN&gt;&lt;A href="http://www.alfresco.org/mediawiki/index.php/Content_Transformations" rel="nofollow noopener noreferrer"&gt;Content Transformations&lt;/A&gt;&lt;SPAN&gt;, which should be enough to get you started.&amp;nbsp; The &lt;/SPAN&gt;&lt;STRONG&gt;PdfBoxContentTransformer&lt;/STRONG&gt;&lt;SPAN&gt; would be a good example to look at.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your subdocuments require transformation to text themselves, then you may have to inject the registry into your transformer, etc.&amp;nbsp; By plugging in your &lt;/SPAN&gt;&lt;STRONG&gt;xxx -&amp;gt; text/plain&lt;/STRONG&gt;&lt;SPAN&gt; transformer into the transformation registry you will start to get full text indexing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2006 13:36:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24830#M12199</guid>
      <dc:creator>derek</dc:creator>
      <dc:date>2006-01-05T13:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24831#M12200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a transformer that iterates over the parts, requests a transformer from the registry, creates a new ContentReader from a temp file and fires transformer#transform. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately this step tries to get a new writable channel which fails because there is already a writer. So I created a new writer from a temp file but then the fulltext search does not find my file because only a temporary file is indexed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So how do I append the text of my sub-parts to the writer of my file?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2006 12:38:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24831#M12200</guid>
      <dc:creator>cburghardt</dc:creator>
      <dc:date>2006-01-06T12:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24832#M12201</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;A ContentReader or ContentWriter cannot be reused.&amp;nbsp; The underlying Channel on a reader or writer can only be created once.&amp;nbsp; Certain operations access the channel and close it automatically (e.g. putFile and getFile), but if you access the channel or stream directly then you are responsible for closing it.&amp;nbsp; However, you can request a new reader from either a reader or writer using #getReader.&amp;nbsp; Be sure to close the output channelbefore using this method on a ContentWriter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm just going to type here, so forgive any obvious issues:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;ContentService contentService;&amp;nbsp; // by Spring injection&lt;BR /&gt;ContentReader sourceReader; // passed in&lt;BR /&gt;ContentWriter targetWriter; // passed in&lt;BR /&gt;&lt;BR /&gt;// do the stuff with the source stream&lt;BR /&gt;…&lt;BR /&gt;List&amp;lt;ContentReader&amp;gt; innerReaders = new ArrayList&amp;lt;ContentReader&amp;gt;(5);&lt;BR /&gt;// some kind of loop&lt;BR /&gt;…&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; String innerMimetype = …; // you get it somehow&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // use the temp writer so that the file will be cleaned up&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ContentWriter innerSource = contentService.getTempWriter();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // fill it with the inner document.&amp;nbsp; Be sure to close the stream if you accessed it directly.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // get a target to transform to&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ContentWriter innerTarget = contentService.getTempWriter();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // now transform&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ContentTransformer innerToTextTransformer = contentTransformerRegistry.getTransformer(innerMimetype, MimetypeMap.TEXT_PLAIN);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; innerToTextTransformer.transform(innerSource.getReader(), innerTarget);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // add the target to the list of readers&lt;BR /&gt;&amp;nbsp;&amp;nbsp; innerReaders.add(innerTarget.getReader());&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// now you have a list of readers that are the text version of all inner documents&lt;BR /&gt;OutputStream targetos = null;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // write the stream to the output target.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; targetOs = targetWriter.getOutputStream();&amp;nbsp;&amp;nbsp; // can only do this once&lt;BR /&gt;&amp;nbsp;&amp;nbsp; for (ContentReader innerReader: innerReaders)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // you can't use targetWriter.putContent(innerReader) because, as the javadoc states,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // the ouput channel will be closed and the reader and writer may only be used once&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InputStream innerSourceIs = innerReader.getInputStream();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; copy(innerSourceIs, targetOs);&amp;nbsp;&amp;nbsp; // inner source input stream will be closed&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;finally&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // close the output stream&lt;BR /&gt;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;}&lt;BR /&gt;// done&lt;BR /&gt;/**&lt;BR /&gt; *&amp;nbsp; Copies the input stream to the output stream, closing only the input stream upon completion&lt;BR /&gt; */&lt;BR /&gt;private void copy(InputStream is, OutputStream os)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // see Spring FileCopyUtils for example code, if required&lt;BR /&gt;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;}&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;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;‍&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 hope it helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2006 13:27:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24832#M12201</guid>
      <dc:creator>derek</dc:creator>
      <dc:date>2006-01-06T13:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24833#M12202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great, works like a charm. Thanks a lot!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2006 23:11:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24833#M12202</guid>
      <dc:creator>cburghardt</dc:creator>
      <dc:date>2006-01-06T23:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24834#M12203</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;SPAN&gt;I try to use your code but without success :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this instruction is my problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;ContentTransformer innerToTextTransformer = contentTransformerRegistry.getTransformer(innerMimetype, MimetypeMap.TEXT_PLAIN);&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The return of this instruction is null. Whatever I do this give me nothing good, no transformer and this for all kind of transformation i've tried.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pls any suggestions ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;JÃ©rÃ´me D.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nb: sorry for my awful english …&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2007 14:35:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24834#M12203</guid>
      <dc:creator>jdeus</dc:creator>
      <dc:date>2007-05-07T14:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24835#M12204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ContentTransformer transformer = contentTransformerService.getTransformer(mimetype, MimetypeMap.MIMETYPE_TEXT_PLAIN);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(the service is set by Spring)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Works with Alfresco 1.4 and 2.0&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2007 17:05:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24835#M12204</guid>
      <dc:creator>cburghardt</dc:creator>
      <dc:date>2007-05-07T17:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-step document transformation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24836#M12205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot, it work like a charm now&amp;nbsp; &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 May 2007 07:41:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/multi-step-document-transformation/m-p/24836#M12205</guid>
      <dc:creator>jdeus</dc:creator>
      <dc:date>2007-05-08T07:41:56Z</dc:date>
    </item>
  </channel>
</rss>

