cancel
Showing results for 
Search instead for 
Did you mean: 

[solved] How to get the value of a custom aspect ?

jbcordina
Champ in-the-making
Champ in-the-making
Hi,

This is my first question here but i worked on alfresco for about 6 month now.
I'm currently creating a complete wizard for a custom content type and i need to get an aspect value of the current folder but i don't  know how i can do.
For the moment, i can only get the aspect list :


NodeRef containerNodeRef;
String nodeId = this.navigator.getCurrentNodeId();
if(nodeId != null) {
    containerNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
} else {
    containerNodeRef = new NodeRef(Repository.getStoreRef(), nodeId);
}
Set aspects = nodeService.getAspects(containerNodeRef);
I can see all the aspects applied to the current space but how to get the value of one of the specific aspect property ?

Sorry for my english, been a long time without speaking or writing in that language, i hope you can understand me Smiley Happy

Thanks in advance.
2 REPLIES 2

nyronian
Champ in-the-making
Champ in-the-making
Object value = nodeService.getProperty(myNodeRef, myQName);

Obviously cast the return value to whatever value was set there.

This will set the property.
this.nodeService.setProperty(myNodeRef,myQName,myObjectValue);

It is assumed the [myQName] is defined in the model as a property of the aspect.

if you look in org.alfresco.model.ContentModel, it will give examples of how to create the proper QNames required to reference the property.

jbcordina
Champ in-the-making
Champ in-the-making
Thank you, it [solved] my problem.