AnsweredAssumed Answered

onUpdateNode shows incorrect value for cm:name updates

Question asked by mikel.asla on Oct 3, 2013
Latest reply on Oct 4, 2013 by mikel.asla
Hi there!

Sorry if this topic allready exists but no luck searching…. also sorry for me poor english

Im trying to register node updates (node properties updates really) in an external php app. Comunications are made via REST.
So I implemented a custom behaviour with java for onUpdateProperties and onUpdateNode policies.
The code calls the external app to register the new properties vlaues.
It works fine when updating any propierties but not for cm:name, which is quite critic for the integration. The new value for cm:name cames like this

{{http://www.alfresco.org/model/content/1.0}name=1522aa8e-c43e-48f9-9b65-099fb4d2c1d8


This is an example simplified code for onUpdateProperties


   …   
   public void init() {
   ….
   this.onUpdateProperties = new JavaBehaviour(
            this,
            "onUpdateProperties",
            NotificationFrequency.FIRST_EVENT);
      
   this.policyComponent.bindClassBehaviour(
            QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
            ContentModel.TYPE_BASE;
            this.onUpdateProperties);
   …
   }



   @Override
   public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) {
      String old_name = before.get(ContentModel.PROP_NAME);      
      String new_name = after.get(ContentModel.PROP_NAME);
      if(logger.isDebugEnabled())
         logger.debug("Old name was : " + old_name
            + " , new name is : " + new_name);
      return;
   }
   …

Suposing is only suitable to log the cm:name updates…. :P

When updating the name of any node, i get


Old name was: text.txt , new name is : 1522aa8e-c43e-48f9-9b65-099fb4d2c1d8

What i'm doing wrong?

Thanks

Outcomes