Oscar Scholten pushed to branch master at cms-community / hippo-repository

Commits:
6265b119 by Sergey Shepelevich at 2017-08-07T16:10:45+02:00
REPO-1759 AutoExport fails to export delete of /content node

- - - - -
f3b1ce1f by Oscar Scholten at 2017-08-08T17:10:36+02:00
REPO-1759 Improve code layout in #removeDescendantDefinitions

- - - - -
72939951 by Oscar Scholten at 2017-08-08T17:17:13+02:00
REPO-1759 Reintegrate branch 'bugfix/REPO-1759'

- - - - -


2 changed files:

- 
engine/src/main/java/org/onehippo/cm/engine/autoexport/DefinitionMergeService.java
- 
engine/src/test/resources/merge/delete-node/in/upstream/hcm-config/upstream.yaml


Changes:

=====================================
engine/src/main/java/org/onehippo/cm/engine/autoexport/DefinitionMergeService.java
=====================================
--- 
a/engine/src/main/java/org/onehippo/cm/engine/autoexport/DefinitionMergeService.java
+++ 
b/engine/src/main/java/org/onehippo/cm/engine/autoexport/DefinitionMergeService.java
@@ -695,8 +695,10 @@ public class DefinitionMergeService {
         for (final ConfigurationNodeImpl childConfigNode : 
configNode.getNodes().values()) {
             for (final DefinitionNodeImpl childDefItem : 
childConfigNode.getDefinitions()) {
                 // if child's DefinitionNode was part of a parent Definition, 
it may have already been removed
+                // also check the definition belongs to one of autoexport 
modules
                 final AbstractDefinitionImpl childDefinition = 
childDefItem.getDefinition();
-                if (!alreadyRemoved.contains(childDefinition)) {
+                if (!alreadyRemoved.contains(childDefinition)
+                        && isAutoExportModule(toExport.values(), 
childDefinition.getSource().getModule())) {
                     // otherwise, remove it now
                     removeOneDefinitionItem(childDefItem, alreadyRemoved, 
toExport);
                 }
@@ -705,6 +707,10 @@ public class DefinitionMergeService {
         }
     }
 
+    private boolean isAutoExportModule(final Collection<ModuleImpl> 
autoExportModules, final ModuleImpl candidate) {
+        return autoExportModules.contains(candidate);
+    }
+
     /**
      * Remove one definition item, either by removing it from its parent or 
(if root) removing the entire definition.
      * Recurs up the DefinitionItem tree to clean up newly-emptied items.


=====================================
engine/src/test/resources/merge/delete-node/in/upstream/hcm-config/upstream.yaml
=====================================
--- 
a/engine/src/test/resources/merge/delete-node/in/upstream/hcm-config/upstream.yaml
+++ 
b/engine/src/test/resources/merge/delete-node/in/upstream/hcm-config/upstream.yaml
@@ -4,3 +4,5 @@ definitions:
       jcr:primaryType: nt:unstructured
     /topmost/upstreamToDelete:
       jcr:primaryType: nt:unstructured
+      /childNode:
+        jcr:primaryType: nt:unstructured



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-repository/compare/ab660c7a695a38428e46a298dcc3e33c3cc889dd...7293995185994a1fa352e4f6742147613e7b83d8

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-repository/compare/ab660c7a695a38428e46a298dcc3e33c3cc889dd...7293995185994a1fa352e4f6742147613e7b83d8
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to