AnsweredAssumed Answered

CopyService and associations

Question asked by marcus on Oct 11, 2006
I'm using copyService.copy(source, target, assocType, qname, dontCopyChildren), which works fine in that it doesn't do a deep copy of children, however it does copy the associations across which means that my newly copied space now links through to the source space. Is there a way to prevent these child associations being copied completely? I can work around it by removing the child associations after the fact, but I'm not sure that's the best way to approach things.

Additionally, if I have a symlink-ish space like this and delete it, it will delete all the lucene information for the multiply linked children, so they are no longer found in PATH searches against the initial node. Just a nice little quirk I found after a couple hours headbanging ;)

Edit: How do I removeAssociations() from a node? If I iterate over the node's childAssociations and call removeAssociation() using that assoc, it doesn't actually get deleted. Is this because the DbNodeServiceImpl.removeAssociation calls


NodeAssoc assoc = nodeDaoService.getNodeAssoc(sourceNode, targetNode, assocTypeQName);
if (assoc == null) return;

which I'm guessing does a DB lookup on the assoc, and if the node has just been created and not persisted, it doesn't find it? Hopefully that made sense hehe

Outcomes