Uploaded image for project: '[Read Only] - Hippo Repository'
  1. [Read Only] - Hippo Repository
  2. REPO-1920

[UpdateExecutor] Provide support for custom node selection/navigation

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 5.2.0, 5.1.1
    • None
    • None
    • 1
    • Platform 173, Platform 174

    Description

      The UpdateExecutor currently requires either a node path or Xpath query definition to select or navigate through the nodes to update.

      For some purposes, reporting (only) in particular, it is more convenient if the NodeUpdateVisitor can provide the nodes to process itself though.

      Therefore the BaseNodeUpdateVisitor will be extended with the following methods to provide its own selection/navigation on the nodes to process (update or just query/report) :

      /**
       * Initiates the retrieval of the nodes when using custom instead of path or xpath (query) based node selection,
       * returning the first node to visit
       * @param session
       * @return first node to visit, or null if none found
       * @throws RepositoryException
       */
      public Node firstNode(final Session session) throws RepositoryException {
          return null; // implement when using custom node selection/navigation
      }
      
      /**
       * Return a following node, when using custom instead of path or xpath (query) based node selection
       * @return next node to visit, or null if none left
       * @throws RepositoryException
       */
      public Node nextNode() throws RepositoryException {
          return null; // implement when using custom node selection/navigation
      }
      

      In addition two more methods are added:

      /**
       * Overridable boolean function to indicate if skipped node paths should be logged (default true)
       * @return true if skipped node paths should be logged
       */
      public boolean logSkippedNodePaths() {
          return true;
      }
      
      /**
       * Overridable boolean function to indicate if node checkout can be skipped (default false)
       * @return true if node checkout can be skipped
       */
      public boolean skipCheckoutNodes() {
          return false; // return true for readonly visitors and/or updates unrelated to versioned content
      }

      The logSkippedNodePaths() method is useful to overrride when a (potentially) huge number of nodes are processed which are expected (or explicitly, like for reporting-only visitors) to be skipped.
      The default implementation will still logs these skipped node paths, and store this in the repository as a binary log.
      To reduce the (unused) report overhead of this binary property hipposys:skipped, a visitor can override this method and return false instead:

      @Override
      boolean logSkippedNodePaths() {
        return false;
      }

      The skipCheckoutNodes() method also is useful to override when running a readonly updater and/or updated unrelated to versioned content.
      The default implementation will ensure nodes are checked out before invoking the doUpdate(Node) method, but that can have considerable overhead if done unnecessarily.
      To reduce this overhead a visitor can override this method and return true instead:

      @Override
      boolean skipCheckoutNodes() {
        return true;
      }

      Attachments

        Issue Links

          Activity

            People

              adouma Ate Douma
              adouma Ate Douma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: