[LIVECOPY-323] Slave specific components are reordered after master push Created: 11/Jul/22  Updated: 18/Jul/22  Resolved: 18/Jul/22

Status: Closed
Project: Live Copy
Component/s: None
Affects Version/s: 3.2.8
Fix Version/s: None

Type: Improvement Priority: Critical
Reporter: Richard Gange Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: 0d
Time Spent: 5h
Original Estimate: Not Specified

Issue Links:
Relates
relates to LIVECOPY-294 (DRAFT) Implement logic for reference... Open
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Documentation update required:
Yes
Date of First Response:
Epic Link: Support

 Description   

Components which are unique to the slave site are reordered to the bottom after a master push.

Reproduce

  1. Add 2 components to master
  2. Push master to slave
  3. Add new component on slave between the 2 components
  4. Push master to slave

Expected
Component added in step3 remains at same position (between first and second component)

Actual
Component added in step3 is now at the bottom

Notes
The change in order is happening during the execution of orderContentNodesInArea. When I get to the session save at the end the node is then pushed to the bottom.

To be considered:

  • Referenced nodes don't change order
  • Referenced nodes don't change order but contain unreferenced nodes.
  • Referenced nodes change order.
  • Referenced nodes change order and contain unreferenced nodes.

Also how to handle a referenced area which has had referenced nodes moved around. What if master has been reordered one way and the referenced ordered another way (purposely). Or is this scenario not supported? In other words, is the order of the master is always respected on a push? I think the only feasible option is to say the master always controls the order of referenced nodes but perhaps needs to be explicitly documented.

OR maybe another possibility is if the number of nodes in the master are is not equal to the number of nodes in the referenced area then ordering is not performed. For example:

/**
* Order the nodes present on the reference page like ordered on the master page.
*/
protected void orderContentNodesInArea(Node masterContentArea, Node referenceContentArea) 
    throws RepositoryException {
    NodeIterator masterContentChildNodes = masterContentArea.getNodes();
    NodeIterator referencedContentChildNodes = referenceContentArea.getNodes();
    Long masterSize = masterContentChildNodes.getSize();
        
    if (masterSize != referencedContentChildNodes.getSize()) {
        String path = referenceContentArea != null ? referenceContentArea.getPath() : "";
        log.info("Skipping reordering of referenced content area {} becuase of size mismatch.", path);
    }
        
    else if (masterSize > 1) {

        Node masterContentChildNode = masterContentChildNodes.nextNode();
        ...
        ...

Generated at Mon Feb 12 02:27:39 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.