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

[External Document Picker] ExternalTreeItemFieldBrowserDialog should resolve expandable ancestor tree nodes from existing tree node data

    XMLWordPrintable

Details

    Description

      At the moment, ExternalTreeItemFieldBrowserDialog#expandPickedExternalTreeItemNodes() depends on ExternalDocumentTreeService#getParent() method invocation to resolve the parent of the specific tree node item, when it needs to expand all the ancestor node of the selected tree node:

      ExternalTreeItemFieldBrowserDialog#expandPickedExternalTreeItemNodes()
           private void expandPickedExternalTreeItemNodes(ExternalDocumentServiceFacade<Serializable> extDocService) {
               for (Serializable item : getPickedExternalDocuments()) {
                   Serializable parent = extDocService.getParent(item);
                   while (parent != null) {
                       treeExpansionSet.add(parent);
                       parent = getExternalDocumentServiceFacade().getParent(parent);
                  }
               }
           }
      

      This is not convenient in reality because:

      • When opening the document in cms editor, it invokes #getFieldExternalDocuments() to get the data of the current selected items. However, in many real use cases, the backend api call may just return only the single item, not including parent-child relationship for the single item query (in REST api for example).

      Also, when looking at the ExternalTreeItemFieldBrowserDialog#expandPickedExternalTreeItemNodes() implementation, I've just realized that it is only about expanding the existing tree nodes of ancestors of the selected tree node item and so it does not have to retrieve the parent from the facade of the backend at all at this moment.

      An improvement would be to resolve the parent item data from the existing (UI) tree provider itself as it already exists there, instead of invoking facade#getParent() again.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wko Woonsan Ko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: