<?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: Using aspects/behaviors to alter content in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33622#M17542</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;i'm looking for a way to incorporate encryption in my space and happened to read your post that might address this. my problem is on how to automatically encrypt (using gpg) all incoming content into a space. gpg from what i know is a command line apps which can be called by other applics like java script. i'm not just sure how to do it in alfresco.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;please help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Jan 2007 06:01:00 GMT</pubDate>
    <dc:creator>pnnerveza</dc:creator>
    <dc:date>2007-01-05T06:01:00Z</dc:date>
    <item>
      <title>Using aspects/behaviors to alter content</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33618#M17538</link>
      <description>Hi,I'm not sure if this question is best suited for this forum or not, but I'll give it a shot.I have added an aspect to my model, let's call it "encrypted", whose value will depend on certain business rules (i.e. encryption enabled for *some* users, but not others).My question is, can I attach a be</description>
      <pubDate>Wed, 08 Feb 2006 19:27:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33618#M17538</guid>
      <dc:creator>bradw</dc:creator>
      <dc:date>2006-02-08T19:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using aspects/behaviors to alter content</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33619#M17539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I seem to have answered my own question through additional trial/error and browsing the source code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First off, policies/behaviors weren't the answer.&amp;nbsp; As I stated in my original post, I have setup and aspect called "encryptable", which contains a property "encryptionLevel".&amp;nbsp; As each document gets added to the repository, I have a rule setup which will automatically apply the aspect based on mime type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now here's where the fun begins.&amp;nbsp; I started browsing through the source code in order to see what really happens when you attempt to view a node's content.&amp;nbsp; That led me to the DownloadContentServlet, which has the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ContentReader reader = contentService.getReader(nodeRef, propertyQName);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;&amp;nbsp;&amp;nbsp; reader.getContent( res.getOutputStream() );&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;It is the ContentReader which provides the InputStream for the actual content data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what I did was to (using the magic of DI), inject my own content service.&amp;nbsp; This class simply extended the existing RoutingContentService and overrode the getReader() method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My custom ContentService.getReader() method will now delegate to the superclass to obtain the original ContentReader, and then it will inspect the NodeRef to see if the desired aspect is present. If so, it will check the aspect's property value to see if encryption should be applied.&amp;nbsp; If not, the original ContentReader is returned, and everying works as normal…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, if encryption is to be applied, I created a decorated ContentReader (called EncryptedContentReader) which gets returned instead of the original one.&amp;nbsp; My custom ContentReader will intercept the getContent() and getContentInputStream() methods, and apply the necessary encryption.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The end result is that programatic encryption has been applied based on aspect existance and property values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good job Alfresco team!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2006 21:22:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33619#M17539</guid>
      <dc:creator>bradw</dc:creator>
      <dc:date>2006-02-08T21:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using aspects/behaviors to alter content</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33620#M17540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oh, just to avoid confusion – I understand that the aspect's property values will be the same for all users. This is simply a proof of concept test for me, so I chose using an aspect. In real-life this would probably manefest itself as some sort of permission/ACL type of attribute that can be set independantly for each user.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2006 21:25:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33620#M17540</guid>
      <dc:creator>bradw</dc:creator>
      <dc:date>2006-02-08T21:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using aspects/behaviors to alter content</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33621#M17541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That's nice work Brad!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 10:55:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33621#M17541</guid>
      <dc:creator>steve</dc:creator>
      <dc:date>2006-02-09T10:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using aspects/behaviors to alter content</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33622#M17542</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;i'm looking for a way to incorporate encryption in my space and happened to read your post that might address this. my problem is on how to automatically encrypt (using gpg) all incoming content into a space. gpg from what i know is a command line apps which can be called by other applics like java script. i'm not just sure how to do it in alfresco.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;please help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jan 2007 06:01:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33622#M17542</guid>
      <dc:creator>pnnerveza</dc:creator>
      <dc:date>2007-01-05T06:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using aspects/behaviors to alter content</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33623#M17543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found your post because I also want to alter content on the fly, but I wonder if wrapping the ContentReader this ways is enough. Can't we run into problems because the getSize method of the FileContentReader will return a value different from the output stream bit count ? Shouldn't the getReader of the custom ContentReader be overriden too, to return an instance of the custom reader ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there other possible traps ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2007 13:58:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-aspects-behaviors-to-alter-content/m-p/33623#M17543</guid>
      <dc:creator>rivarola</dc:creator>
      <dc:date>2007-09-05T13:58:28Z</dc:date>
    </item>
  </channel>
</rss>

