AnsweredAssumed Answered

Copy nodes - duplicates

Question asked by gjovanov on Oct 2, 2009
Latest reply on Oct 30, 2009 by openpj
We have a very specific situation where we want to copy only children nodes recursively from a given source to a given destination space. The problem is that the source children spaces can already be contained in the destination space. And the when we copy them, for the common spaces we get duplicates in the destination whereas the duplicates occur with the name: "Copy of" + original-name. What we want to achieve is FILE_SYSTEM-copy-like operation as if when a space already exist within the destination should be skipped and it should continue to its children.

e.g. first we copy Designs children spaces:
/Company Home/Templates/Design/01-Offer/…

to the destination:
/Company Home/Projects/Kiss/

as a result we get:
/Company Home/Projects/Kiss/01-Offer/

and then we want to copy Developments children spaces:
/Company Home/Templates/Development/01-Offer/…

also to the same destination:
/Company Home/Projects/Kiss/

and as a result we get:
/Company Home/Projects/Kiss/01-Offer/..
                                          /Copy of 01-Offer/..
                                          /Copy of 02-Testing/…

Even though we would expect the following result:
/Company Home/Projects/Kiss/01-Offer/..

we use the CMLCopy command for every child within the source folder:

        CMLCopy copy = new CMLCopy();
        copy.setWhere(new Predicate(new Reference[] { sourceReference }, STORE, null));

        CML cml = new CML();
        cml.setCopy(new CMLCopy[] { copy });


Any suggestions?