cancel
Showing results for 
Search instead for 
Did you mean: 

Node API

removedquasar
Champ in-the-making
Champ in-the-making
I'm making a custom action and i want to change the description of a file (node), inside alfresco.

I saw that there are methods like setTitle and setDescription but i found them only for actions or others (wiki pages ecc).

Those methods are aviable for nodes? (if yes please tell me which API is). Thanks.
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

the description of a file is a regular property of the node that represents that file. The JavaScript API has a simplification for this, so you can set the description via a setDescription method (or the shorthand version of node.description = "new description";). When writing a custom action in Java, you need to use the Alfresco Foundation API / Services to work with nodes / NodeRef. In order to alter the description, you need to use the NodeService and either one of its addProperties / setProperty methods. The Alfresco wiki contains a Cookbook on working with nodes that might be of interest to you.

Regards
Axel

removedquasar
Champ in-the-making
Champ in-the-making
Okay but a little question: the "description property" of the file, exist as default or i have to create it inside my custom model?

I saw this line:

nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);

ContentModel is a custom or default model? Because PROP_NAME doesen't work in my code.

afaust
Legendary Innovator
Legendary Innovator
Hello,

ContentModel is a default model - you should be able to import it if working against the SDK or the alfresco data model JAR.

Regards
Axel

removedquasar
Champ in-the-making
Champ in-the-making
Thank you so much for this, i solved my problem importing ContentModel :mrgreen: