Uploaded image for project: 'Live Copy'
  1. Live Copy
  2. LIVECOPY-162

The action "push master content changes" will not push all changed properties

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Critical
    • None
    • 3.1

    Description

      Hi Magnolia Team,

      with live copy version 3.1 the action "push master content changes" will not push all properties to the slaves.
      The problem is, that the method updateMasterProperties in the PropagateMasterContentChangesHelper returns true after it finds one property that has changed (see code line 536 and 542 - Bildschirmfoto 2019-09-16 um 17.45.15.png). Instead this boolean value has to be saved to a variable and has to be returned at the end of the function (outside the while loop). Otherwise only one property will be handled.

      The updateMasterProperties method should look something like this:

      private boolean updateMasterProperties(Node masterNode, Node referencedNode) throws RepositoryException {
              boolean propertyChanged = false;
              PropertyIterator masterProperties = masterNode.getProperties();
              while (masterProperties.hasNext()) {
                  Property masterProperty = masterProperties.nextProperty();
      
                  if (isPropertyExcluded(referencedNode, masterProperty.getName())) {
                      continue;
                  }
      
                  if (masterProperty.isMultiple()) {
                      if (referencedNode.hasProperty(masterProperty.getName())) {
                          referencedNode.setProperty(masterProperty.getName(), masterProperty.getValues());
                      }
                  } else {
                      // If the slave node has this kind of property then
                      // update it
                      if (referencedNode.hasProperty(masterProperty.getName())) {
                          // If the property value changed
                          Property referencedProperty = referencedNode.getProperty(masterProperty.getName());
                          if (!masterProperty.getValue().getString().equals(referencedProperty.getValue().getString())) {
                              referencedProperty.setValue(masterProperty.getValue());
                              log.info("Updating a property for the page: {} property is: {} master content page is: {} New Value: {} Old value: {}", referencedProperty.getValue().getString(), referencedNode.getPath(),
                                  referencedProperty.getName(), masterNode.getPath(), masterProperty.getValue().getString());
                              propertyChanged = true;
                          }
                      } else {
                          // This property is new
                          referencedNode.setProperty(masterProperty.getName(), masterProperty.getValue());
                          log.info("Setting a new property for the page: {} property is: {} master content page is: {}", referencedNode.getPath(), masterProperty.getName(), masterNode.getPath());
                          propertyChanged = true;
                      }
                  }
              }
              return propertyChanged;
          }
      

      Thanks and best regards
      Jürgen

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                juergenulrich Jürgen Ulrich
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD