The problem with copy node | Community
Skip to main content
October 16, 2015
Solved

The problem with copy node

  • October 16, 2015
  • 5 replies
  • 1538 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

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.

5 replies

Lokesh_Shivalingaiah
Level 10
October 16, 2015

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

October 16, 2015

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

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
October 16, 2015

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.

October 16, 2015

Hi bsloki,

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

 

Brian

Community Advisor
October 16, 2015

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.