Added removeChildAssociation method to NodeService

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4706 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-01-02 14:25:16 +00:00
parent f2c70b78e1
commit 61c2f1a614
8 changed files with 179 additions and 34 deletions

View File

@@ -885,6 +885,41 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
}
}
/**
* TODO: Check implementation
*/
public boolean removeChildAssociation(ChildAssociationRef childAssocRef)
{
NodeRef parentRef = childAssocRef.getParentRef();
NodeRef childRef = childAssocRef.getChildRef();
Pair<Integer, String> parentVersionPath = AVMNodeConverter.ToAVMVersionPath(parentRef);
if (parentVersionPath.getFirst() >= 0)
{
throw new InvalidNodeRefException("Read only store.", parentRef);
}
Pair<Integer, String> childVersionPath = AVMNodeConverter.ToAVMVersionPath(childRef);
if (childVersionPath.getFirst() >= 0)
{
throw new InvalidNodeRefException("Read only store.", childRef);
}
String parentPath = parentVersionPath.getSecond();
String childPath = childVersionPath.getSecond();
String [] childPathBase = AVMNodeConverter.SplitBase(childPath);
if (childPathBase[0] == null || !childPathBase[0].equals(parentPath))
{
return false;
}
try
{
fAVMService.removeNode(childPathBase[0], childPathBase[1]);
return true;
}
catch (AVMNotFoundException e)
{
throw new InvalidNodeRefException("Not found.", childRef);
}
}
/**
* @param nodeRef
* @return Returns all properties keyed by their qualified name