AnsweredAssumed Answered

How to move a node while keeping primary child relationship?

Question asked by nicolasraoul on Apr 16, 2010
Latest reply on Apr 20, 2010 by nicolasraoul
Hello all,

I transform original.txt into a PDF, and I want this PDF to be a primary child of original.txt, but stored in a different space.
My Java code uses NodeService.createNode to create the PDF, and it works well, it is indeed a primary child.

Now I wrote a FileFolderService.move code line to move the PDF to a different space, it works, but the PDF is not a primary child of original.txt anymore.
How can I move the PDF to a different space while allowing it to keep being a primary child of original.txt ?

If you need it, here is the code:
ChildAssociationRef associationToPublished = nodeService.createNode(
    original,
    QName.createQName("http://www.my.co.jp/", "approvedVersion"),
    QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "test"),
    QName.createQName("http://www.my.co.jp/", "approvedDocument"));
NodeRef published = associationToPublished.getChildRef();
fileFolderService.move(published, publicationSpace, "published.pdf");

Note: I need the primary relationship so that the publication is removed if the original is removed, without policies.

Thanks!

Outcomes