AnsweredAssumed Answered

specialize content @ onContentUpdate

Question asked by saconni on May 9, 2008
Hi guys!

First, sorry if this is not the right place for this topic. Didn't
find a better one

This is my issue:

I have written a content type, extending the basic content type. Then
I wrote a JScript policy to be executed on content update the bean xml
is


       <bean id="cm.content.onContentUpdate"
class="org.alfresco.repo.policy.registration.ClassPolicyRegistration"
parent="policyRegistration">
               <property name="policyName">
                       <value>{http://www.alfresco.org}onContentUpdate</value>
               </property>
               <property name="className">
                       <value>{http://www.alfresco.org/model/content/1.0}content</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/extension/scripts/cm.content.onContentUpdate.js</value>
                                               </constructor-arg>
                                       </bean>
                               </property>
                       </bean>
               </property>
       </bean>

The Script checks the file name extension and if the file satisfy some
parsing rules. If every thing is ok, the content is specialized to my
custom content type.



nodeRef.specializeType("{my.model.content}document");
nodeRef.save();


Uploading content through the web client works like charm, but when I
upload a file using the alfresco file server, something funny
happened: the new conent node lacks of any of the basic content type
properties (title, description, etc). Is like specializing the type in
that specific moment prevents alfresco from creating the attribute
nodes.

Some body have any clue about what is happening, or even better know
an alternative way to specialize a document in the precise moment it
is uploaded.

Thanks a lot, in advance.

And again, sorry if this is not the right place to post this issue.

Outcomes