AnsweredAssumed Answered

OnContentRead behavior

Question asked by cristianfrog on Dec 14, 2013
Latest reply on Dec 19, 2013 by cristianfrog
Three days I'm stuck on this:

I want to execute a script when users READ files on Alfresco. I read Jeff Potts guide "Implementing custom behaviors" and tried to create a behavior using OnContentRead policy.

This is what I did until now:

Modified custom-model-context.xml like this:

<?xml version='1.0' encoding='UTF-8'?>


    <!– Registration of new models –>   
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
<bean id="onContentReadpolicy" class="org.alfresco.repo.policy.registration.ClassPolicyRegistration" parent="policyRegistration">
      <property name="policyName">
      <property name="className">
      <property name="behaviour">
         <bean class="org.alfresco.repo.jscript.ScriptBehaviour" parent="scriptBehaviour">
            <property name="location">
               <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">


And added a simple myscript.js in alfresco/extension/scripts.

When I restart Alfresco it doesn't work, it seems to crash at all…
I'm pretty sure I'm doing something wrong, I looked at alfresco.log but can't understand what's the problem…

Hope in some help!

P.S. I'm using Alfresco Community version 4.2.e on Windows 7 machine