AnsweredAssumed Answered

How to correctly add an aspect to a node?

Question asked by imphilippesimo on Oct 4, 2016
Latest reply on Oct 6, 2016 by kaynezhang


im using alfresco public java APIs to manage an alfresco repository.

Therefore, in one of my methods, i want to add a custom aspect to a node.

i tried to do as it's mentioned in the NodeRef cookbook


QName CUSTOM_ASPECT_QNAME = QName.createQName("", 'treated');
       QName PROP_QNAME_MY_PROPERTY = QName.createQName("", 'myProperty');
       Map<QName,Serializable> aspectValues = new HashMap<QName,Serializable>();
       aspectValues.put(PROP_QNAME_MY_PROPERTY, value);
       nodeService.addAspect(nodeRef, CUSTOM_ASPECT_QNAME, aspectValues);


Unfortunately, i got this exception:


org.alfresco.service.cmr.dictionary.InvalidAspectException: 09040002 The aspect is invalid: {}treated

    at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspect_aroundBody32(


Can someone tell me what am i doing wrong?