AnsweredAssumed Answered

CML  Move problem

Question asked by mangar on Dec 22, 2010
Latest reply on Jan 5, 2011 by jcustovic
I have 2 directories like this:

/app:company_home/cm:divisionA/cm:productDetails
/app:company_home/cm:divisionB

I am trying to move the directory and contents from divistionA to divisionB.  I have done this successfully with the following code:


String newParentDir = "/app:company_home/cm:divisionB";

ParentReference folderParentRef = new ParentReference();
folderParentRef.setStore(storeRef);
folderParentRef.setPath(newParentDir);
folderParentRef.setAssociationType(Constants.ASSOC_CONTAINS);

// create ref to current dir
String currentDir = "/app:company_home/cm:divisionA/cm:productDetails";
Reference curr = new Reference();
curr.setStore(storeRef);
curr.setPath(currentDir);

CMLMove move = new CMLMove();
move.setAssociationType(Constants.ASSOC_CONTAINS);
move.setChildName("productDetails");
move.setTo(folderParentRef);
move.setWhere(new Predicate(new Reference[]{curr}, null, null));

CML cml = new CML();
cml.setMove(new CMLMove[]{move});
WebServiceFactory.getRepositoryService().update(cml);               

Like I said the code works fine. 

The problem comes when I try to switch it back.  This should be as simple as switching the values of currentDir and newParentDir, but when I do, I get that ever popular "Node does not exist" error.

Well of course it exists, I just moved it there!  Why can't I move it back?
It's all there in the web front end, content and all.

Anyone have any ideas?

Outcomes