cancel
Showing results for 
Search instead for 
Did you mean: 

How to change name property in metadata extracter ?

dacia_berlina
Champ in-the-making
Champ in-the-making
I create a custom metadata extracter in order to gather some additional information (i just add some code to a copy of OfficeMetadataExtracter).
Now, when i add an office document to alfresco, some custom properties and even some default properties(like: title, description) automaticaly receiv some values chosen by me.
But, i was unable to change the name property of the document.
I used putRawValue method:

           putRawValue("alfname", "New NAME chosen by Me", rawProperties);
           putRawValue("alfdesc", "my file description", rawProperties);
and alfname is declared in custom-metadata-extractors-context.xml:

           <prop key="alfname">cm:name</prop>
           <prop key="alfdesc">cm:description</prop>

Does anybody know how to change the name property ? Or, it is impossible to change it in the extracter ?
2 REPLIES 2

dacedos
Champ in-the-making
Champ in-the-making
Maybe you can use method:

NodeService.setProperty(nodeRef, qname, value)

something like:

NodeService nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
nodeService.setProperty(nodeRef, QName.createQName(Constants.PROP_NAME), "New NAME chosen by Me")

dacia_berlina
Champ in-the-making
Champ in-the-making
dacedos thanks for your very quick reply.
Unfortunately, i didn't manage to run the code.. i have no ideea who is nodeRef or how to get the noderef for curent node (while being in the extractor method).

I made some other researches and i think i found the solution. it seems that it works if i change the overwritePolicy to EAGER (PRAGMATIC was the default one).