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

Set vs Update for complex list elements

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.10
    • Fix Version/s: 7.10-HF30, 8.10-HF12, 9.3
    • Component/s: Core
    • Backlog priority:
      500
    • Upgrade notes:
      Hide

      Setting the value of a complex property now overwrites any previous values, and does not do a partial update anymore.

      This is controlled by the <clearComplexPropertyBeforeSet> element of the "configuration" extension point of org.nuxeo.ecm.core.schema.TypeService.

      For backports the old behavior is kept by default, but this can be changed if needed.

      Note that the compatibility mode (false) is DEPRECATED in 9.3, and will be removed in a future version.

      Show
      Setting the value of a complex property now overwrites any previous values, and does not do a partial update anymore. This is controlled by the <clearComplexPropertyBeforeSet> element of the "configuration" extension point of org.nuxeo.ecm.core.schema.TypeService. For backports the old behavior is kept by default, but this can be changed if needed. Note that the compatibility mode (false) is DEPRECATED in 9.3, and will be removed in a future version.
    • Sprint:
      nxFG 8.2.2, nxFG 8.3.1, nxFG 8.3.2, nxFG 8.3.3, nxFG 8.4.1, nxFG 8.4.2, nxFG 8.4.4, nxFG 8.10.2, nxFG 9.1.4, nxFG 9.1.6, nxFG 9.1.7, nxFG 9.1.8, nxFG 9.3.2, nxFG 9.3.1
    • Story Points:
      3

      Description

      We have the following behavior currently in 8.10 and 7.10:

      If we have a doc with a complex property of {"foo": "foo1", "bar": "bar1"} and set the complex property (using setPropertyValue) to {"bar": "bar2"} then re-reading the property gives {"foo": "foo1", "bar": "bar2"}.
      Let's denote this by:

      {"foo": "foo1", "bar": "bar1"} & {"bar": "bar2"} -> {"foo": "foo1", "bar": "bar2"}
      

      This means that setProperty actually does an update and not a replace, which IMHO unexpected.
      If we have a list of complex properties, the behavior is basically the same.

      So in 7.10/8.10 we have:

       {"foo": "foo1", "bar": "bar1"}  &  {"bar": "bar2"}  ->  {"foo": "foo1", "bar": "bar2"}
      [{"foo": "foo1", "bar": "bar1"}] & [{"bar": "bar2"}] -> [{"foo": "foo1", "bar": "bar2"}]
      

      However previously in 6.0 and before we had a different and internally inconsistent behavior:

       {"foo": "foo1", "bar": "bar1"}  &  {"bar": "bar2"}  ->  {"foo": "foo1", "bar": "bar2"}
      [{"foo": "foo1", "bar": "bar1"}] & [{"bar": "bar2"}] -> [{"bar": "bar2"}]
      

      So the list case behaved like a replace while the direct complex property case behaved like an update.

      None of this is satisfactory. Ideally this is the behavior we want because it provides the least surprise:

       {"foo": "foo1", "bar": "bar1"}  &  {"bar": "bar2"}  ->  {"bar": "bar2"}
      [{"foo": "foo1", "bar": "bar1"}] & [{"bar": "bar2"}] -> [{"bar": "bar2"}]
      

      The question is how to deal with backward compatibility...

      Note that someone that really wants to update just a sub-property and not replace the other fields can always just do that using doc.getProperty("complex/foo").setValue("foo2").

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 week, 2 days
                  1w 2d

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.