AnsweredAssumed Answered

Add tag B whenever tag A is added: help needed

Question asked by hbf on Aug 21, 2008
Hello!

A quick question: I need to make sure that whenever a user adds tag A, also tag B is added.

I think the Alfresco-way to achieve this is to code a behaviour that registers with NodeServicePolicies.OnUpdatePropertiesPolicy. With this, the method

void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)

gets called when a tag is added/removed.

My question: Am I allowed to call

nodeService.setProperty(nodeRef, ContentModel.PROP_CATEGORIES, (Serializable) tags);

within onUpdateProperties()? Or should I change the list

(List<NodeRef>) after.get(ContentModel.PROP_CATEGORIES)

(Or am I not allowed to do any modifications at all?)

I could not find this in the documentation and would be happy to receive guidance.

Thanks
Kaspar

Outcomes