<?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 transform just the content? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201374#M154504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, I think I'm figuring it out, off to try some code…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Feb 2009 19:01:16 GMT</pubDate>
    <dc:creator>opoplawski</dc:creator>
    <dc:date>2009-02-19T19:01:16Z</dc:date>
    <item>
      <title>How to transform just the content?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201371#M154501</link>
      <description>I'd like to be able to transform just the content of a document without automatically creating a new document (which causes problems with versioning….).&amp;nbsp; The idea would be something like:&amp;nbsp; var pdfWorkingCopy = pdffile.checkout();&amp;nbsp; pdfWorkingCopy.content = transformContent("application/pdf",document.</description>
      <pubDate>Thu, 12 Feb 2009 18:30:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201371#M154501</guid>
      <dc:creator>opoplawski</dc:creator>
      <dc:date>2009-02-12T18:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform just the content?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201372#M154502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The JavaScript API appears to require a new ScriptNode to be created which contains the transformed data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One option would be to copy the data from the new file back into the old (and then discard the new file).&amp;nbsp; This is a bit wasteful, perhaps, but I think it also presents a problem for you due to versioning.&amp;nbsp; Not entirely sure what that means but let's assume this won't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A better option is one that leverages the extensibility of Alfresco's platform.&amp;nbsp; With Alfresco, you can write any custom repository action that you want and then invoke it from JavaScript.&amp;nbsp; This means that things are flexible but it also means that it is a bit more involved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To do so, you can write a Spring Bean which implements a repository Action.&amp;nbsp; This is then available in JavaScript via the Actions API.&amp;nbsp; Suppose you wrote an action called "mytransform" - you could then do something like the following in JavaScript:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var transformer = actions.create("mytransform");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;transformer.parameters.targetMimetype = "pdf";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;transformer.execute(doc);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could have your action take the content stream from the current document, transform it to the specified mimetype and then plug it back into the object.&amp;nbsp; You could adjust input parameters to suit whatever your need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To build a custom action, you would have get comfortable with the ActionExecuter pattern in the Java code.&amp;nbsp; Since Alfresco is open source, you can take a look at how the product looks and how it presently does transformations.&amp;nbsp; Specifically, take a look at:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;org.alfresco.repo.action.executer.TransformActionExecuter&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is an implementation of a transformer action that you could base your custom action on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There may be a much easier way but this is certainly an option.&amp;nbsp; It gives you the maximum amount of control, allows you to consolidate your code and gives you a nice reusable bit of logic that you can plug into your Alfresco repository framework.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Michael&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2009 23:01:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201372#M154502</guid>
      <dc:creator>uzi</dc:creator>
      <dc:date>2009-02-12T23:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform just the content?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201373#M154503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It seems like what I need is already in the underlying Java API.&amp;nbsp; TransformActionExecutor.doTransform() takes a sourceNodeRef and contentReader and a destinationNodeRef and contentWriter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I can't figure out (as a complete noob to JavaScript-&amp;gt;Java interaction) is what connects the "documentTransform()" javascript call to a java call (presumably TransformActionExecutor.executeImpl())?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2009 18:29:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201373#M154503</guid>
      <dc:creator>opoplawski</dc:creator>
      <dc:date>2009-02-19T18:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to transform just the content?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201374#M154504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, I think I'm figuring it out, off to try some code…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2009 19:01:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-transform-just-the-content/m-p/201374#M154504</guid>
      <dc:creator>opoplawski</dc:creator>
      <dc:date>2009-02-19T19:01:16Z</dc:date>
    </item>
  </channel>
</rss>

