[jira] [Commented] (SLING-8243) Content Loader - support merge of properties and child nodes

2021-04-20 Thread Konrad Windszus (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-8243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17325729#comment-17325729
 ] 

Konrad Windszus commented on SLING-8243:


The behaviour differs between JSON and XML:
# XML is only influenced through flag {{overwrite}}. This actually means 
"replace" 
(https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/79957492ebda588b3a6e03d6a8642048b448b855/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentImporter.java#L141).
 The flags {{merge}}, {{mergeProperties}} and {{overwriteProperties}} are not 
considered at all!
# JSON also deletes the existing node when {{overwrite}} is set to true 
(https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/79957492ebda588b3a6e03d6a8642048b448b855/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java#L248).
 

So to me it seems that 
- {{merge}} and {{mergeProperties}} only makes a difference if {{overwrite}} = 
{{false}}
- {{merge}} is only implemented for JSON 
(https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/79957492ebda588b3a6e03d6a8642048b448b855/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java#L966)
- {{merge}} has the same effect as {{overwrite}}, but the former removes the 
old child nodes at the end, while the latter removes the old entry node in the 
beginning. The effect should be the same though.
- {{mergeProperties}} is different, as it will overwrite existing properties 
with the same name but keeps others. That only makes a difference if the node 
does exist already 
(https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/79957492ebda588b3a6e03d6a8642048b448b855/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentCreator.java#L686)

> Content Loader - support merge of properties and child nodes
> 
>
> Key: SLING-8243
> URL: https://issues.apache.org/jira/browse/SLING-8243
> Project: Sling
>  Issue Type: New Feature
>Reporter: Jason E Bailey
>Assignee: Jason E Bailey
>Priority: Major
> Fix For: JCR ContentLoader 2.4.0
>
>
> Currently the Content Loader doesn't support a merge feature, a merge feature 
> would provide the ability for the an import to update existing properties and 
> nodes, and additionally delete the specific properties and nodes that aren't 
> imported.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-8243) Content Loader - support merge of properties and child nodes

2021-04-19 Thread Jason Bailey (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-8243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17324997#comment-17324997
 ] 

Jason Bailey commented on SLING-8243:
-

It's been 2 1/2 years since I touched this code and the overwrite and 
overwriteProperties were preexisting configurations. If I remember correctly, 
if you imported a node structure over an existing node structure without any 
properties set, It would just add new node's and properties starting from the 
top. So let's say the top node "A" with a child of "B" if you imported a new 
node of "A" that had a child of "C" it wouldn't do anything. "A" already exists 
so it doesn't get overwritten. Since it doesn't get overwritten it never gets 
to the child level to add "C". If set overwrite to true then your final result 
will be a top level node of "A" with two children of "B" and "C". If you then 
add the merge directive on your import the result will be a top level node of 
"A" with a singular child of "C"

If you chose all 4 of the directives you would essentially be replacing the 
existing content with the new content.

I'll see if I can pull together a diagram to explain it.

> Content Loader - support merge of properties and child nodes
> 
>
> Key: SLING-8243
> URL: https://issues.apache.org/jira/browse/SLING-8243
> Project: Sling
>  Issue Type: New Feature
>Reporter: Jason E Bailey
>Assignee: Jason E Bailey
>Priority: Major
> Fix For: JCR ContentLoader 2.4.0
>
>
> Currently the Content Loader doesn't support a merge feature, a merge feature 
> would provide the ability for the an import to update existing properties and 
> nodes, and additionally delete the specific properties and nodes that aren't 
> imported.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-8243) Content Loader - support merge of properties and child nodes

2021-04-19 Thread Konrad Windszus (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-8243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17324805#comment-17324805
 ] 

Konrad Windszus commented on SLING-8243:


[~jebailey] Ping again. 
Also it is not really clear what the differences are {{overwrite}} and 
{{overwriteProperties}}. What happens if both directives are set to {{true}}?

> Content Loader - support merge of properties and child nodes
> 
>
> Key: SLING-8243
> URL: https://issues.apache.org/jira/browse/SLING-8243
> Project: Sling
>  Issue Type: New Feature
>Reporter: Jason E Bailey
>Assignee: Jason E Bailey
>Priority: Major
> Fix For: JCR ContentLoader 2.4.0
>
>
> Currently the Content Loader doesn't support a merge feature, a merge feature 
> would provide the ability for the an import to update existing properties and 
> nodes, and additionally delete the specific properties and nodes that aren't 
> imported.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-8243) Content Loader - support merge of properties and child nodes

2020-03-02 Thread Jason E Bailey (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-8243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17049550#comment-17049550
 ] 

Jason E Bailey commented on SLING-8243:
---

[~sseifert] yes, I'll take care of that.

> Content Loader - support merge of properties and child nodes
> 
>
> Key: SLING-8243
> URL: https://issues.apache.org/jira/browse/SLING-8243
> Project: Sling
>  Issue Type: New Feature
>Reporter: Jason E Bailey
>Assignee: Jason E Bailey
>Priority: Major
> Fix For: JCR ContentLoader 2.4.0
>
>
> Currently the Content Loader doesn't support a merge feature, a merge feature 
> would provide the ability for the an import to update existing properties and 
> nodes, and additionally delete the specific properties and nodes that aren't 
> imported.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (SLING-8243) Content Loader - support merge of properties and child nodes

2020-03-02 Thread Stefan Seifert (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-8243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17049314#comment-17049314
 ] 

Stefan Seifert commented on SLING-8243:
---

[~jebailey] can you update the documentation as well?
https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html

from the code i took that two new directives {{mergeProperties}} and {{merge}} 
where introduced.

> Content Loader - support merge of properties and child nodes
> 
>
> Key: SLING-8243
> URL: https://issues.apache.org/jira/browse/SLING-8243
> Project: Sling
>  Issue Type: New Feature
>Reporter: Jason E Bailey
>Assignee: Jason E Bailey
>Priority: Major
> Fix For: JCR ContentLoader 2.3.2
>
>
> Currently the Content Loader doesn't support a merge feature, a merge feature 
> would provide the ability for the an import to update existing properties and 
> nodes, and additionally delete the specific properties and nodes that aren't 
> imported.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)