cancel
Showing results for 
Search instead for 
Did you mean: 

Setting properties by the time of adding documents via CIFS

alex888
Champ in-the-making
Champ in-the-making
Hi,

I have a two-level  hierarchy of spaces like this:

Root
|- Client1
      |- Matter11
      |- Matter12
|- Client2
      |- Matter21
      |- Mattero22

|- Clientn
      |- Mattern1


I mean, one root space (inside Company Home) and one first level of client spaces with matter subspaces inside each one. Documents can be added to the matter subspaces and all of them have a "Client" property and a "Matter" property. I need to set these two properties with the name of the client space and matter space by the moment a document is included in a client space via CIFS. Please, could anyone let me know which is the best way to do it?, maybe a script executed by an inbound action?

Kind regards and thanks in advance.
4 REPLIES 4

lotharm
Champ on-the-rise
Champ on-the-rise
The easiest solution would be the configuration of an inbound rule that examines the space structure and will set the properties. However, I experienced performance issues with rules, so it depends on the use case if the rule approach will work for you.

I tend to use the behavior hooks to do something like this. They are more complicated, Java only, not that well documented, but perform much better. That's what I'm after Smiley Happy

Regards

alex888
Champ in-the-making
Champ in-the-making
Thanks for your reply Lothar, to be honest I know nothing about behaviours. Do you know if there is any easy example to start with?. Nut in the other hands the words "Java Only" are music for me!!! I'm a bit fed up with XML configurations …  Smiley Very Happy

lotharm
Champ on-the-rise
Champ on-the-rise
Check out the policy component at http://wiki.alfresco.com/wiki/Policy_Component and various implementations that come with Alfresco.

zaizi
Champ in-the-making
Champ in-the-making
Check out the Records Management from the Alfresco subversion repository. It has a great example of how to use behaviours to inherit properties from parent spaces. You won't need to write any java code.

1. Define behaviour to bind to "onCreateNode".
2. Run Javascript to look up properties from parent space and update current space / content. NB: Javascript means you can update business logic easily without requiring to re-compile and deploy code.


   <bean id="org_alfresco_module_RecordsManagement_onCreateNode_rmaFilePlan" class="org.alfresco.repo.policy.registration.ClassPolicyRegistration" parent="policyRegistration">  
        <property name="policyName">
           <value>{http://www.alfresco.org}onCreateNode</value>          
        </property>       
        <property name="className">
            <value>{http://www.alfresco.org/model/record/1.0}filePlan</value>
        </property>                   
        <property name="behaviour">
           <bean class="org.alfresco.repo.jscript.ScriptBehaviour" parent="scriptBehaviour">
              <property name="location">
                 <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
                     <constructor-arg>
                        <value>alfresco/module/org.alfresco.module.RecordsManagement/script/onCreateNode_rmaFilePlan.js</value>
                     </constructor-arg>
                  </bean>
            </property>
         </bean>       
        </property>
    </bean>