Aspect details

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
hsjawanda
Member II

Aspect details

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
andy
Active Member

Re: Aspect details

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