cancel
Showing results for 
Search instead for 
Did you mean: 

get Node Aspect properties

toze
Champ in-the-making
Champ in-the-making
Hi.
How can i get all the properties of one Aspect i have?
I have Aspec test with 3 properties.

Like this, i get all aspect's of the node
Set<QName> listaAspectos = nodeService.getAspects(nodeRef);

So, how can i get all properties of the aspect Test?
9 REPLIES 9

janv
Employee
Employee
Is this what you're looking for … ?


// note: untested example ….
Map<QName, Serializable> allNodeProps = nodeService.getProperties(nodeRef);
Map<QName, PropertyDefinition> aspectPropDefs = dictionaryService.getAspect(aspectQName).getProperties(); // including inherited props
Map<QName, Serializable> nodeProps = new HashMap<QName, Serializable>(aspectPropDefs.size());
for (QName propQName : aspectPropDefs.keySet())
{
    Serializable value = allNodeProps.get(propQName);
    if (value != null)
    {
        nodeProps.put(propQName, value);
    }
}
Regards,
Jan

toze
Champ in-the-making
Champ in-the-making
im going to test that and will reply you some thing

vekariyakeyur
Champ in-the-making
Champ in-the-making
How to get Node's any property by name ?
I am getting array of NamedValue from Node but , iterating it over and over and checking for match name is quite time consuming , is there any api or method  available for getting value of particular property by its name ,,
Kindly help me …

mrogers
Star Contributor
Star Contributor
In Java there is a nodeService.getProperty method.

yroopa1229
Champ in-the-making
Champ in-the-making
in BaseEvaluator how we get properties of aspects

vekariyakeyur
Champ in-the-making
Champ in-the-making
Hi, thanks for the reply….
One more question which dependency i required to get node service ?

I tried with adding alfresco war in my project, I am generating war with overlay as there lots of other wars are as dependencies, but my final war was not generating properly…

I have read that *-context.xml of alfresco required to get node service  , but which dependency is required ? and which other jars need to be added as dependencies ?

can i add jars only to do that ? and which are they ?

yogeshpj
Star Contributor
Star Contributor
You need ServiceRegistry (org.alfresco.service.ServiceRegistry) for getting nodeService.

yroopa1229
Champ in-the-making
Champ in-the-making
Hi for create  Custom Evaluator in BaseEvaluator java class how can we get properties of a particular aspect 

When you will extend BaseEvaluator you will have to override evaluate(JSONObject jsonObj) method.

This method has JSONObject as argument. You can get the properties from this JSONObject object. like:
String strNodeRef = (String) jsonObj.get("nodeRef");
or
String customProp = (String) jsonObj.get("Your custom property name");


Thanks,
Nazakat