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

Make dirty field management more accurate

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 7.2
    • Component/s: Core, Seam / JSF UI
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      A document's property is now dirty only when the new value is different.

      The DublinCoreListener update the dc:modified, dc:contributors and dc:lastContributor on beforeDocumentModification only if the document is dirty (i.e. only if some value changed).
      The modified and contributors are still updated on lifecycle_transition_event even if the document is not dirty.

      There's a dirty management on array property items: ArrayProperty.isDirty(index).

      A document's snapshot version is created only if any field changed (doc is dirty).

      A method is available on property to force the dirty status even if the property value doesn't change on setValue (setForceDirty). It's used by the SimpleDocumentModel class to keep the previous behaviour on it.

      The DocumentValidationService validates only dirty properties if it's asked as usual - but also validates only dirty sub properties and dirty arrayproperty's items.

      Many test were updated (when a snapshot creation was expected without any change).

      Show
      A document's property is now dirty only when the new value is different. The DublinCoreListener update the dc:modified, dc:contributors and dc:lastContributor on beforeDocumentModification only if the document is dirty (i.e. only if some value changed). The modified and contributors are still updated on lifecycle_transition_event even if the document is not dirty. There's a dirty management on array property items: ArrayProperty.isDirty(index). A document's snapshot version is created only if any field changed (doc is dirty). A method is available on property to force the dirty status even if the property value doesn't change on setValue (setForceDirty). It's used by the SimpleDocumentModel class to keep the previous behaviour on it. The DocumentValidationService validates only dirty properties if it's asked as usual - but also validates only dirty sub properties and dirty arrayproperty's items. Many test were updated (when a snapshot creation was expected without any change).
    • Sprint:
      Sprint io 7.2-1

      Description

      Current Dirty field management has several issues that we should address :

      Only the fields really changed should be marked as dirty

      Currently the JSF Layout Model will always set of Document Fields that are bound to widgets.

      As a result, all the fields are always marked as dirty :

      • this makes validation system not efficient (running check for nothing)
      • this makes listener work harder (ex:when you want to know what really changed)

      DocumentModel should provide an API to retrieve all dirty fields

      Currently there is no DocumentModel level API to get all dirty fields : you have to iterate recursively through the schemas and fields :

      • this is painful
      • this is not efficient (recurse through 100's a fields to discover that none are dirty)

      Complex field should be better handled

      Let's consider a complex type that is a list of address and I update the street number for one of the address, what we should have is :

      
       # addresses (*)
          - adress1 : 
               street : AAA
               number : 3
               zipCode : XXX
          - adress2 : (*)
               street : BBB
               number : 7 (*)
               zipCode : YYY
      
      

      Diff

      If we expose an API at DocumentModel level, may be we could also store the old values to be able to have a diff ...

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: