Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-20221

onUpdateNode and onUpdateProperties returns incorrect value on cm:name updates

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.2.c Community
    • Fix Version/s: None
    • Component/s: Repository
    • Security Level: external (External user)
    • Labels:
      None
    • Environment:
      Ubuntu 12.04
      Bundle install througth alfresco-community-installer-linux-64.bin

      Description

      1. Implement custom behaviour for onUpdateNode or onUpdateProperties

      (for example)

      ...
      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 before, Map 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; }

      ...

      2. Update any node name throught Alfresco Share's "edit properties" UI Action
      3. Check the "after" value returned for cm:name
      (other propierties work just fine)

      4. I get

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

      instead of

      {{http://www.alfresco.org/model/content/1.0}name=new_name.txt

        Attachments

          Issue Links

            Activity

            Hide
            dhulley Derek Hulley added a comment -

            Please turn on DEBUG for org.alfresco.repo.node.AbstractNodeServiceImpl as this produces detailed output around invokeOnUpdateProperties.
            The NodeService fires the policy on every change it makes, so my guess is that Share is making two changes and you're only getting the first of these notifications. Once we see the debug, we can determine whether the process could be streamlined or not.

            Show
            dhulley Derek Hulley added a comment - Please turn on DEBUG for org.alfresco.repo.node.AbstractNodeServiceImpl as this produces detailed output around invokeOnUpdateProperties . The NodeService fires the policy on every change it makes, so my guess is that Share is making two changes and you're only getting the first of these notifications. Once we see the debug, we can determine whether the process could be streamlined or not.
            Hide
            mikel.asla Mikel Asla added a comment -

            This is the output for the same file, same modification

            2013-10-08 18:03:13,719  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] The following properties have been updated:  (nodeRef=workspace://SpacesStore/43d7edf5-39e3-4595-bae3-67eb63a98390)
             2013-10-08 18:03:13,722  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9]    - The property {http://www.alfresco.org/model/content/1.0}name has been updated.
             2013-10-08 18:03:13,724  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9]    - The property {http://www.alfresco.org/model/content/1.0}taggable has been set for the first time.
             2013-10-08 18:03:13,725  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9]    - The property {http://www.alfresco.org/model/content/1.0}categories has been set for the first time.
             2013-10-08 18:03:13,727  DEBUG [repo.behaviour.ElggAlfrescoBehaviourManager] [http-apr-8080-exec-9] ---- Custom behaviour triggered for OnUpdateProperties NodeServicePolicy ----
            NodeRef= workspace://SpacesStore/43d7edf5-39e3-4595-bae3-67eb63a98390
            Before: {{http://www.alfresco.org/model/content/1.0}name=Entourage_bso.txt, {http://www.alfresco.org/model/content/1.0}lastThumbnailModification=[doclib:1381224506453], {http://www.alfresco.org/model/system/1.0}node-dbid=1082, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/8/11/28/ce1902ac-7018-40a5-80c4-620bfeebac0b.bin|mimetype=text/plain|size=11807|encoding=UTF-8|locale=es_ES_|id=324, {http://www.alfresco.org/model/content/1.0}title={es=bso.txt}, {http://www.alfresco.org/model/system/1.0}node-uuid=43d7edf5-39e3-4595-bae3-67eb63a98390, {http://www.alfresco.org/model/content/1.0}taggable=null, {http://www.alfresco.org/model/content/1.0}modified=Tue Oct 08 18:03:13 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Tue Oct 08 11:28:16 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}categories=null, {http://www.alfresco.org/model/content/1.0}modifier=mikel}
            After: {{http://www.alfresco.org/model/content/1.0}name=f25bf5c3-7479-491d-8258-edf26f8eb5c9, {http://www.alfresco.org/model/content/1.0}lastThumbnailModification=[doclib:1381224506453], {http://www.alfresco.org/model/system/1.0}node-dbid=1082, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/8/11/28/ce1902ac-7018-40a5-80c4-620bfeebac0b.bin|mimetype=text/plain|size=11807|encoding=UTF-8|locale=es_ES_|id=324, {http://www.alfresco.org/model/content/1.0}title={es=bso.txt}, {http://www.alfresco.org/model/system/1.0}node-uuid=43d7edf5-39e3-4595-bae3-67eb63a98390, {http://www.alfresco.org/model/content/1.0}taggable=null, {http://www.alfresco.org/model/content/1.0}modified=Tue Oct 08 18:03:13 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Tue Oct 08 11:28:16 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}categories=null, {http://www.alfresco.org/model/content/1.0}modifier=mikel}
             2013-10-08 18:03:13,727  DEBUG [repo.behaviour.ElggAlfrescoBehaviourManager] [http-apr-8080-exec-9] {http://www.alfresco.org/model/content/1.0}name Property has changed
             2013-10-08 18:03:13,862  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] The following properties have been updated:  (nodeRef=workspace://SpacesStore/43d7edf5-39e3-4595-bae3-67eb63a98390)
             2013-10-08 18:03:13,863  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9]    - The property {http://www.alfresco.org/model/content/1.0}name has been updated.
             2013-10-08 18:03:13,864  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9]    - The property {http://www.alfresco.org/model/content/1.0}taggable has been set for the first time.
             2013-10-08 18:03:13,865  DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9]    - The property {http://www.alfresco.org/model/content/1.0}categories has been set for the first time.
            
            Show
            mikel.asla Mikel Asla added a comment - This is the output for the same file, same modification 2013-10-08 18:03:13,719 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] The following properties have been updated: (nodeRef=workspace://SpacesStore/43d7edf5-39e3-4595-bae3-67eb63a98390) 2013-10-08 18:03:13,722 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] - The property {http://www.alfresco.org/model/content/1.0}name has been updated. 2013-10-08 18:03:13,724 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] - The property {http://www.alfresco.org/model/content/1.0}taggable has been set for the first time. 2013-10-08 18:03:13,725 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] - The property {http://www.alfresco.org/model/content/1.0}categories has been set for the first time. 2013-10-08 18:03:13,727 DEBUG [repo.behaviour.ElggAlfrescoBehaviourManager] [http-apr-8080-exec-9] ---- Custom behaviour triggered for OnUpdateProperties NodeServicePolicy ---- NodeRef= workspace://SpacesStore/43d7edf5-39e3-4595-bae3-67eb63a98390 Before: {{http://www.alfresco.org/model/content/1.0}name=Entourage_bso.txt, {http://www.alfresco.org/model/content/1.0}lastThumbnailModification=[doclib:1381224506453], {http://www.alfresco.org/model/system/1.0}node-dbid=1082, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/8/11/28/ce1902ac-7018-40a5-80c4-620bfeebac0b.bin|mimetype=text/plain|size=11807|encoding=UTF-8|locale=es_ES_|id=324, {http://www.alfresco.org/model/content/1.0}title={es=bso.txt}, {http://www.alfresco.org/model/system/1.0}node-uuid=43d7edf5-39e3-4595-bae3-67eb63a98390, {http://www.alfresco.org/model/content/1.0}taggable=null, {http://www.alfresco.org/model/content/1.0}modified=Tue Oct 08 18:03:13 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Tue Oct 08 11:28:16 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}categories=null, {http://www.alfresco.org/model/content/1.0}modifier=mikel} After: {{http://www.alfresco.org/model/content/1.0}name=f25bf5c3-7479-491d-8258-edf26f8eb5c9, {http://www.alfresco.org/model/content/1.0}lastThumbnailModification=[doclib:1381224506453], {http://www.alfresco.org/model/system/1.0}node-dbid=1082, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/8/11/28/ce1902ac-7018-40a5-80c4-620bfeebac0b.bin|mimetype=text/plain|size=11807|encoding=UTF-8|locale=es_ES_|id=324, {http://www.alfresco.org/model/content/1.0}title={es=bso.txt}, {http://www.alfresco.org/model/system/1.0}node-uuid=43d7edf5-39e3-4595-bae3-67eb63a98390, {http://www.alfresco.org/model/content/1.0}taggable=null, {http://www.alfresco.org/model/content/1.0}modified=Tue Oct 08 18:03:13 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Tue Oct 08 11:28:16 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}categories=null, {http://www.alfresco.org/model/content/1.0}modifier=mikel} 2013-10-08 18:03:13,727 DEBUG [repo.behaviour.ElggAlfrescoBehaviourManager] [http-apr-8080-exec-9] {http://www.alfresco.org/model/content/1.0}name Property has changed 2013-10-08 18:03:13,862 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] The following properties have been updated: (nodeRef=workspace://SpacesStore/43d7edf5-39e3-4595-bae3-67eb63a98390) 2013-10-08 18:03:13,863 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] - The property {http://www.alfresco.org/model/content/1.0}name has been updated. 2013-10-08 18:03:13,864 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] - The property {http://www.alfresco.org/model/content/1.0}taggable has been set for the first time. 2013-10-08 18:03:13,865 DEBUG [repo.node.AbstractNodeServiceImpl] [http-apr-8080-exec-9] - The property {http://www.alfresco.org/model/content/1.0}categories has been set for the first time.
            Hide
            dhulley Derek Hulley added a comment - - edited

            So the change is happening in two stages and your're only requesting the first occurrence. Technically, applications are entitled to make any number of changes to a node; as long as they occur within the transaction, it hardly makes any difference. Nevertheless, we may be able to cut out this two-stage change (I will raise an issue for that depending on the investigation, here).

            As a workaround, you can use the TRANSACTION_COMMIT notification frequency.

            One more check:
            Do the name modification via the Alfresco Explorer client (/alfresco) and post the same logging, please.

            Show
            dhulley Derek Hulley added a comment - - edited So the change is happening in two stages and your're only requesting the first occurrence. Technically, applications are entitled to make any number of changes to a node; as long as they occur within the transaction, it hardly makes any difference. Nevertheless, we may be able to cut out this two-stage change (I will raise an issue for that depending on the investigation, here). As a workaround, you can use the TRANSACTION_COMMIT notification frequency. One more check: Do the name modification via the Alfresco Explorer client ( /alfresco ) and post the same logging, please.
            Hide
            mikel.asla Mikel Asla added a comment -

            I tried your workaround and is working for me.

            This is the output for a name update through alfresco explorer, colects the incorrect name also with FIRST_EVENT

            2013-10-24 20:40:25,939  DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2] The following properties have been updated:  (nodeRef=workspace://SpacesStore/472f8561-297c-4152-8944-054c035cc3db)
             2013-10-24 20:40:25,941  DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2]    - The property {http://www.alfresco.org/model/content/1.0}name has been updated.
             2013-10-24 20:40:25,955  DEBUG [repo.behaviour.ElggAlfrescoBehaviourManager] [ajp-apr-8009-exec-2] ---- Custom behaviour triggered for OnUpdateProperties NodeServicePolicy ----
            NodeRef= workspace://SpacesStore/472f8561-297c-4152-8944-054c035cc3db
            Before: {{http://www.alfresco.org/model/content/1.0}name=Overview.pdf, {http://www.alfresco.org/model/system/1.0}node-dbid=6780, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/24/20/40/b7bda5f1-551e-4736-a406-f353e84a3d6b.bin|mimetype=application/pdf|size=859678|encoding=UTF-8|locale=es_ES_, {http://www.alfresco.org/model/content/1.0}title={es=Overview.pdf}, {http://www.alfresco.org/model/system/1.0}node-uuid=472f8561-297c-4152-8944-054c035cc3db, {http://www.alfresco.org/model/content/1.0}author=, {http://www.alfresco.org/model/content/1.0}modified=Thu Oct 24 20:40:25 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Thu Oct 24 20:40:04 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}modifier=mikel}
            After: {{http://www.alfresco.org/model/content/1.0}name=1b06a720-55a5-4e56-b98c-68232d6bf43e, {http://www.alfresco.org/model/system/1.0}node-dbid=6780, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/24/20/40/b7bda5f1-551e-4736-a406-f353e84a3d6b.bin|mimetype=application/pdf|size=859678|encoding=UTF-8|locale=es_ES_, {http://www.alfresco.org/model/content/1.0}title={es=Overview.pdf}, {http://www.alfresco.org/model/system/1.0}node-uuid=472f8561-297c-4152-8944-054c035cc3db, {http://www.alfresco.org/model/content/1.0}author=, {http://www.alfresco.org/model/content/1.0}modified=Thu Oct 24 20:40:25 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Thu Oct 24 20:40:04 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}modifier=mikel}
             2013-10-24 20:40:25,996  DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2] The following properties have been updated:  (nodeRef=workspace://SpacesStore/472f8561-297c-4152-8944-054c035cc3db)
             2013-10-24 20:40:25,997  DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2]    - The property {http://www.alfresco.org/model/content/1.0}name has been updated.
            
            Show
            mikel.asla Mikel Asla added a comment - I tried your workaround and is working for me. This is the output for a name update through alfresco explorer, colects the incorrect name also with FIRST_EVENT 2013-10-24 20:40:25,939 DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2] The following properties have been updated: (nodeRef=workspace://SpacesStore/472f8561-297c-4152-8944-054c035cc3db) 2013-10-24 20:40:25,941 DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2] - The property {http://www.alfresco.org/model/content/1.0}name has been updated. 2013-10-24 20:40:25,955 DEBUG [repo.behaviour.ElggAlfrescoBehaviourManager] [ajp-apr-8009-exec-2] ---- Custom behaviour triggered for OnUpdateProperties NodeServicePolicy ---- NodeRef= workspace://SpacesStore/472f8561-297c-4152-8944-054c035cc3db Before: {{http://www.alfresco.org/model/content/1.0}name=Overview.pdf, {http://www.alfresco.org/model/system/1.0}node-dbid=6780, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/24/20/40/b7bda5f1-551e-4736-a406-f353e84a3d6b.bin|mimetype=application/pdf|size=859678|encoding=UTF-8|locale=es_ES_, {http://www.alfresco.org/model/content/1.0}title={es=Overview.pdf}, {http://www.alfresco.org/model/system/1.0}node-uuid=472f8561-297c-4152-8944-054c035cc3db, {http://www.alfresco.org/model/content/1.0}author=, {http://www.alfresco.org/model/content/1.0}modified=Thu Oct 24 20:40:25 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Thu Oct 24 20:40:04 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}modifier=mikel} After: {{http://www.alfresco.org/model/content/1.0}name=1b06a720-55a5-4e56-b98c-68232d6bf43e, {http://www.alfresco.org/model/system/1.0}node-dbid=6780, {http://www.alfresco.org/model/system/1.0}store-identifier=SpacesStore, {http://www.alfresco.org/model/system/1.0}locale=es_ES, {http://www.alfresco.org/model/content/1.0}content=contentUrl=store://2013/10/24/20/40/b7bda5f1-551e-4736-a406-f353e84a3d6b.bin|mimetype=application/pdf|size=859678|encoding=UTF-8|locale=es_ES_, {http://www.alfresco.org/model/content/1.0}title={es=Overview.pdf}, {http://www.alfresco.org/model/system/1.0}node-uuid=472f8561-297c-4152-8944-054c035cc3db, {http://www.alfresco.org/model/content/1.0}author=, {http://www.alfresco.org/model/content/1.0}modified=Thu Oct 24 20:40:25 CEST 2013, {http://www.entelgy.com/model/content/1.0}docType=No Clasificado, {http://www.alfresco.org/model/content/1.0}created=Thu Oct 24 20:40:04 CEST 2013, {http://www.alfresco.org/model/system/1.0}store-protocol=workspace, {http://www.alfresco.org/model/content/1.0}description={es=}, {http://www.alfresco.org/model/content/1.0}creator=mikel, {http://www.alfresco.org/model/content/1.0}modifier=mikel} 2013-10-24 20:40:25,996 DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2] The following properties have been updated: (nodeRef=workspace://SpacesStore/472f8561-297c-4152-8944-054c035cc3db) 2013-10-24 20:40:25,997 DEBUG [repo.node.AbstractNodeServiceImpl] [ajp-apr-8009-exec-2] - The property {http://www.alfresco.org/model/content/1.0}name has been updated.
            Hide
            resplin Richard Esplin added a comment -

            This issue was reported against an old version of Alfresco Community Edition.

            Alfresco Community Edition 201605 GA contains Alfresco Platform 5.1.g and Alfresco Share 5.1.f. This release includes many improvements that address old problems. We are closing old issues so that we can better prioritize our efforts.

            If you verify that the issue still exists in the latest release of Alfresco Community Edition, please reopen the issue. If you have any trouble reopening the issue, then leave a comment or email us at community@alfresco.com so that we can assist.

            Thank you for collaborating with us on improving Alfresco.

            Show
            resplin Richard Esplin added a comment - This issue was reported against an old version of Alfresco Community Edition. Alfresco Community Edition 201605 GA contains Alfresco Platform 5.1.g and Alfresco Share 5.1.f. This release includes many improvements that address old problems. We are closing old issues so that we can better prioritize our efforts. If you verify that the issue still exists in the latest release of Alfresco Community Edition, please reopen the issue. If you have any trouble reopening the issue, then leave a comment or email us at community@alfresco.com so that we can assist. Thank you for collaborating with us on improving Alfresco.

              People

              • Assignee:
                closedissues Closed Issues
                Reporter:
                mikel.asla Mikel Asla
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: