Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

The problem with copy node

Avatar

Former Community Member

Hi there,

Please see following code to copy a node:

        Node src = session.getRootNode().getNode("content/geometrixx-outdoors/en/men/coats/edmonton-winter/jcr:content"); Node dstParent = session.getRootNode().getNode("content/geometrixx-outdoors/fr/men/coats/edmonton-winter"); JcrUtil.copy(src, dstParent, "jcr:content"); session.save(); session.logout();

But the result seems the des-page lack of anything, please see following:

This is source page:

[img]copy.png[/img]

This is des-page:

[img]copy2.png[/img]

 

So why happened that? and how to deal with it? Anyone could help see it? Thanks a lot in advance.

 

Best regards,

Brian

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hey Brian,

 when I again re-looked at them, I think it might be because of this

You are copying from 'en' to 'fr' and

Header missing:

under 'fr' you dont have the nodes for 'women','equipment' and others which are there in 'en' and once you copy them aswell it should appear in the header

Footer missing:

There will be pages 'About us', 'Privacy Policy' and others in 'en' which might be again missing in 'fr'. Once you have them in 'fr' it should come over.

View solution in original post

5 Replies

Avatar

Level 10

Hi Brian,

 The mismatch parts as per your screenshot belongs to the templates. So check if your destination page/node uses the same template as that of the source page/node.

 

Thanks,

bsloki

Avatar

Former Community Member

hi bsloki,

I just use this JCR API to copy a node to another path. As per your point out something, how do you think to deal with it if need to use the same template as that of the source page/node?

Thanks a lot.

Brian

Avatar

Correct answer by
Level 10

Hey Brian,

 when I again re-looked at them, I think it might be because of this

You are copying from 'en' to 'fr' and

Header missing:

under 'fr' you dont have the nodes for 'women','equipment' and others which are there in 'en' and once you copy them aswell it should appear in the header

Footer missing:

There will be pages 'About us', 'Privacy Policy' and others in 'en' which might be again missing in 'fr'. Once you have them in 'fr' it should come over.

Avatar

Former Community Member

Hi bsloki,

You are good and i catch your meaning.Thank you so much.

 

Brian

Avatar

Level 9

It seems that you are using JcrUtil to copy a node. Node copy just copies a node not a page. I believe you need to use PageManager API to copy page.