<?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: automatic invoking of policy and behaviour in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30276#M15534</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi thank u for ur prompt reply,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;my question is in VersionableAspect.java there are three behaviors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;onAddAspect, onContentUpdate, onCopyNode how exactly does the program knows which behavior gets instantiated, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am looking to create a new policy that gets instantiated automatically.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks prasanth&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jan 2006 14:06:15 GMT</pubDate>
    <dc:creator>pmarreddy</dc:creator>
    <dc:date>2006-01-11T14:06:15Z</dc:date>
    <item>
      <title>automatic invoking of policy and behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30274#M15532</link>
      <description>hi,how exactly is policy is invoked (i.e automatically like it is doine in audit), i saw the tests but i cant not understand them clearly. if any body could explain me with an example that would be great.thanks in advprasanth.</description>
      <pubDate>Wed, 11 Jan 2006 11:47:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30274#M15532</guid>
      <dc:creator>pmarreddy</dc:creator>
      <dc:date>2006-01-11T11:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: automatic invoking of policy and behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30275#M15533</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;Have a look at VersionableAspect.java (found in the repository project) as an&amp;nbsp; example of code that binds behaviour to a particular policy (in this case it is used to implement the auto-version behaviour).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you provide some details about what you would like to achieve?&amp;nbsp; This info may help in providing you a more helpful answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Roy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2006 13:48:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30275#M15533</guid>
      <dc:creator>rwetherall</dc:creator>
      <dc:date>2006-01-11T13:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: automatic invoking of policy and behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30276#M15534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi thank u for ur prompt reply,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;my question is in VersionableAspect.java there are three behaviors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;onAddAspect, onContentUpdate, onCopyNode how exactly does the program knows which behavior gets instantiated, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am looking to create a new policy that gets instantiated automatically.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks prasanth&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2006 14:06:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30276#M15534</guid>
      <dc:creator>pmarreddy</dc:creator>
      <dc:date>2006-01-11T14:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: automatic invoking of policy and behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30277#M15535</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;Ok, I'll talk you through some of the relevant code in VersionableAspect and hopefully it will answer your question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lets say, for example, you would like a chunk of code to be executed every time an aspect of a particular type is applied to a node.&amp;nbsp; In this example we are interested in binding behaviour to the 'onAddAspect' policy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can think of a policy as a repository event.&amp;nbsp; For example every time an aspect is applied to a node the repository triggers the onAddAspect policy.&amp;nbsp; At this point any behaviours (like event handlers) that have been registered for that policy and meet the type restrictions defined, when the behaviour was bound, will be fired.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To bind to behaviour to a policy we use code similar to this …&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; this.policyComponent.bindClassBehaviour(&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; QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),&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; ContentModel.ASPECT_VERSIONABLE,&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; new JavaBehaviour(this, "onAddAspect"));&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Here we are binding to the onAddAspect behaviour (1st parameter), this behaviour will only be fired if the node in question has the versionable aspect applied (2nd parameter).&amp;nbsp; The behaviour implementation is the 3rd parameter and in this example its a method called "onAddAspect" in "this" class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what the method could look like …&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do some stuff ….&amp;nbsp;&amp;nbsp; &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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps to explain things,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Roy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2006 14:25:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30277#M15535</guid>
      <dc:creator>rwetherall</dc:creator>
      <dc:date>2006-01-11T14:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: automatic invoking of policy and behaviour</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30278#M15536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thank u verymuch for ur kind reply.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2006 14:46:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/automatic-invoking-of-policy-and-behaviour/m-p/30278#M15536</guid>
      <dc:creator>pmarreddy</dc:creator>
      <dc:date>2006-01-11T14:46:46Z</dc:date>
    </item>
  </channel>
</rss>

