Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-9503

Inconsistent management of cacheKey and saveDocument

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: QualifiedToSchedule
    • Component/s: Core
    • Backlog priority:
      0

      Description

      CacheKey is used in Seam context to manage navigationContext invalidation.

      Unfortunately, the cacheKey management is inconsistent with the way AbstractSession.saveDocument works.

       // get the current doc
       DocumentModel doc = navigationContext.getCurrentDocument();
      
       // at this point doc.getCacheKey() = K1
      
       doc.setPropertyValue("dc:title", "changed title");
       DocumentModel modifiedDoc = documentManager.saveDocument(doc);
      
       // at this point doc.getCacheKey() = K2
       // at this point modifiedDoc.getCacheKey() = K2
      
       // here my problem is that I would expect doc.getCacheKey() == K1
      
       // because of that navigation won't work
       // since doc.getCacheKey()==modifiedDoc.getCacheKey()
       navigationContext.navigateToDocument(modifiedDoc);
      
       // in most of the cases this is not an issue since 
       // doc and modifiedDoc contains almost the same data
       // but for example the adapter cache is not correct
      

      Potential real fix could be :

      • change the way navigationContext manage cacheKey (i.e. store cacheKey)
      • include inside cacheKey a parameter "dirty" that would be set bu saveDocument on the orginial DocumentModel
      • change saveDocument implementation to never change the content of the input DocumentModel

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tdelprat Thierry Delprat
                Reporter:
                tdelprat Thierry Delprat
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: