cancel
Showing results for 
Search instead for 
Did you mean: 

Aspect details

hsjawanda
Champ in-the-making
Champ in-the-making
Hi all,

I have a few questions about aspects:
  • I can get a list of aspects applied to a node by using NodeService#getAspects().  Now how do I distinguish between mandatory and non-mandatory aspects?

  • What will I have to do to search properties added through aspects?

  • When programatically creating a node that has at least one mandatory aspect associated with it, is it the responsibility of the caller to add the mandatory aspect(s)?  Or does this happen automatically (inside Alfresco code)?  If the latter, then how and where?  What happens if a mandatory aspect is not added to a node?
I can get metadata about defined aspects from the DictionaryService, right?

Thanks.
1 REPLY 1

andy
Champ on-the-rise
Champ on-the-rise
Hi


I can get a list of aspects applied to a node by using NodeService#getAspects(). Now how do I distinguish between mandatory and non-mandatory aspects?

You can get the aspects for the type using something like:

dictionaryService.getType(nodeService.getType(nodeRef)).getDefaultAspects();

where dictionaryService and nodeService are the respective beans.


What will I have to do to search properties added through aspects?

These will be indexed and you should be able to search for them.



    When programatically creating a node that has at least one mandatory aspect associated with it, is it the responsibility of the caller to add the mandatory aspect(s)? Or does this happen automatically (inside Alfresco code)? If the latter, then how and where? What happens if a mandatory aspect is not added to a node?

Default aspect will be added . If aspects have mandatory properties and these have default values, these will be added. If there are unset mandatory properties, which do not have defaults, you will get integrity violations.

Regards

Andy