Uploaded image for project: 'Bloomreach Forge'
  1. Bloomreach Forge
  2. FORGE-154

Pojo binding: compound deletion is based on incoming contentNode compounds

    XMLWordPrintable

Details

    Description

      Method DefaultJcrContentNodeBinder#bind() has this piece of code to delete existing compounds, before re-adding the compounds based on the incoming contentNode POJO

      for (ContentNode childContentNode : contentNode.getNodes()) {
          if (itemFilter != null && !itemFilter.accept(childContentNode)) {
              continue;
          }
      
          for (Node sameNameTypeChildNode : findChildNodesByNameAndType(jcrDataNode, childContentNode)) {
              sameNameTypeChildNode.remove();
          }
      }
      

      The problem here is that the deletions are also based on incoming contentNode POJO's compounds, so if the POJO does not contain a certain name/type, but the actual JCR node does, it will not get deleted from the JCR node.

      Cases where this occurs:
      A) Content blocks field with compounds A and B: add A, B, A; binding is OK, then remove B, binding will not remove B
      B) Multiple compound field: add A1 + A2, binding is OK, then remove A2, binding is OK, then remove A1, binding will not remove A1
      C) Optional compound field: add B1, binding is OK, then remove B1, binding will not remove B1

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jhoffman Jeroen Hoffman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: